IFrames and Alternate Content Injection

Stephen Yagielowicz

Not to be confused with old-style frames and framesets, inline frames (iframes) are the foundation of many popular ad network, affiliate and content injection tools; such as “status update” boxes, data feeds, “like” buttons and other widgets which extend a site’s content range and revenue generating opportunities.

Although not the only coding option for many of its applications, iframes have some unique capabilities and properties that lend themselves nicely to many adult website uses; including user authentication, such as the schemes implemented by top social networks.

iframes have some unique capabilities and properties that lend themselves nicely to many adult website uses.

While perhaps not the best solution, this author has used iframes as a workaround to scripting conflicts that prevented one application or another from running when directly added to a web page’s source code. Placing the problematic script (such as a slideshow), on its own page and then calling it into the desired page, makes it easy to get a mockup running while the programming conflicts are resolved.

The nesting of iframes offers many other intriguing possibilities, including enabling easier displays of alternative content based upon the criteria selected by the site operator or visitor — such as the user’s geolocation; login / membership status or search keyword / results; random ordering; or whatever else you want to use as a “trigger” to dynamically update the URL that the selected iframe (or iframes) displays — since more than one can be used and linked to. Even without nesting, iframes can be used for alternative content switching and display; such as showing a PDF in an iframe window without leaving the main web page, or leveraging the licensing fees for your video player by not embedding it directly on to a page on a different domain (requiring a new license), but by displaying the player page hosted on the domain it is licensed for — a potentially decent cost saver.

Iframe nesting also offers a workable, albeit cumbersome solution to HTML5 valid, pixel-perfect positioning, where the newest coding standard’s drop of support for iframe tags such as marginheight or marginwidth are leading to validation problems and leaving compliant coders with crooked corners and unequal spacing.

HTML5’s new “seamless” attribute, while currently unsupported by most browsers, holds forth the promise of cleaner content injection with a more unified look and feel to the site adding this material, and indicates a long life ahead for the helpful iframe tag — clearing the way for more widespread adoption.

Of course, there are implementation alternatives for many of these applications, including the <object> tag, which can in many cases be used in lieu of the iframe tag.

The use of AJAX or other techniques for alternative content injection are admired for their more search engine friendly approach, but this may not always be a concern if you do not own the inserted content; i.e., does it really matter to you if the ad network you use is getting “link juice” from your site?

Using iframes to deliver external content also offers security benefits over other means, such as AJAX or JSON, as the iframed content is restricted to the iframe itself — providing coding isolation that is further enhanced by HTML5’s new “sandbox” attribute. This helps prevent, for example, viruses or other rogue payloads carried by a third-party widget from corrupting your site’s coding. Content hosted on the same domain name as the site featuring the iframe, may have more “freedom” to interact with the rest of a site, allowing webmasters to find a fit to nearly any content injection need.

One other factor to be aware of is the performance penalty associated with third-party ads and content loaded into iframes.

Regardless of how you use them, iframes are an indispensible element of modern web design that could be profitably incorporated into nearly any type of adult website today.


More Articles


Privacy Notices Shouldn’t Be Treated as an Afterthought

Corey D. Silverstein ·

Legal Issues Pop Up When Filming Sex in Public

Lawrence G. Walters ·

A Road Less Traveled: Accepting Alternative Payment Solutions

Stephen Yagielowicz ·

Credit Card Processing Today: Decline or Dominance?

Stephen Yagielowicz ·

Shifting Regulations: Keeping on the Straight and Narrow

Stephen Yagielowicz ·

Putting Your Best Foot Forward: Billing's Best Practices

Stephen Yagielowicz ·

PornDoe Premium — 35 Network Sites and Counting

Rhett Pardon ·

Q&A: White Label Dating’s Steve Pammenter Expands Horizons

Alejandro Freixes ·

Facebook Ends Custom Link Preview Snippets

Lauren MacEwen ·
Show More