Cedar Jensen
Cedar Jensen

Reputation: 293

iframe for ad loading good or bad?

According to Yahoo's "Best Practices for Speeding Up your Site", the pros for using iframes:

but the cons are:

I want to use an iframe to load ads using the technique mentioned on this site: http://meanderingpassage.com/2007/08/15/keeping-javascript-widgets-from-controlling-your-blog/

Does using this technique mean that as soon as the html contents requested by the iframe are returned to the client, it will load the ad script, potentially blocking the rest of the page's rendering and downloading? Or will the iframe request get processed concurrently while rest of the document is downloaded and rendered?

I'm, however, not looking for a discussion on the philosophy of whether ads are good or bad.

Upvotes: 9

Views: 9509

Answers (3)

nstory
nstory

Reputation: 187

If you're putting in ads, you probably want to use AdSense (or at least test it out). The Google AdSense robot doesn't like iframes:
https://www.google.com/support/adsense/bin/answer.py?hl=en&answer=10035

Upvotes: 0

dthorpe
dthorpe

Reputation: 36082

I'm not quite sure why the Yahoo list says "Blocks page onload". IFrames load independently of the parent page, particularly if the iframe content is in a different domain than the main page. The "Blocks page onload" seems contradictory to the pros, both of which are due to concurrency of the iframe load.

Now, if you have an iframe that is loading something from the same domain name as the main page, that may fall into the browser's connection limit per domain, and therefore impact how quickly the main page can download its content. But if the iframe URL is a different domain, it should get its own connection limit per domain.

The biggest pro for iframes is security isolation. When you load third party script into an iframe, you don't have to worry about the third party script taking over your page and scrawling graffitti all over the place, or stealing user data from your script variables.

The biggest con for iframes is also the security isolation. ;> The brick wall that protects you from third parties also makes it very difficult to communicate / share info between parties on the same web page.

Upvotes: 9

tloflin
tloflin

Reputation: 4050

Rendering of the interior iframe is processed concurrently with the exterior page. Any javascript inside the iframe will only prevent loading of the contents inside the iframe.

Edit: also, I just noticed I answered your previous question on this subject, and as explained there it's possible to trigger iframe loading in javascript whenever you wish (e.g. after the rest of the page is loaded).

Upvotes: 8

Related Questions