When using a third party ad server, do you use the IFRAME or JavaScript method? Usually the JS method is more robust and offers more features, but it can slow down page rendering times. Currently struggling with this battle right now.

11 Years
Discussion Span
Last Post by Dani

JavaScript. I'd think interpreting/running a script wouldn't be that much slower than loading an entire IFRAME. Plus, IFRAMES... I just never cared for frames.


Well with JavaScript, it is loaded inline with the rest of the site. So lets say you have a banner near the top of the page. If the ad server is slow, the rest of your site gets delayed in being rendered. Even worse, if the server is having a problem connecting, your site will just show whitespace and never finish loading below the ad placement. On the other hand, with IFRAMES, your entire site gets loaded first, and then the ads.


But JavaScript doesn't have to be loaded first. It could just as easily be the LAST thing you run on the page. Also, you can code it as a separate request via AJAX/XMLHTTPRequest.

What do Frames/Iframes do to SEO?


This whole conversation is completely SEO-irrelevant because they're ads ... either way you're making a call to an ad server. Well that's my question ... how can I make the JavaScript the last thing I run on the page, when it includes document.write() statements? For example, take the Google AdSense code ... you put it wherever you want AdSense to appear. What if that is near the top of the page? If Google's server is lagging, the rest of your site doesn't get loaded.

How can I use AJAX? No experience there. :) But interested!


You shouldn't be using code that contains document.write() statements. That's deprecated and may or may not work based upon doctype.

I haven't looked at Google Adsense code since... nevermind. Awhile. And since it's being provided, you might be break all sorts of rules if you modified it.

In general, you'd have a div where you wanted the ad. You'd have a script to retrieve the ad image/link code. You'd place that script at the very bottom of your page. Then you'd have a script after that, which alters the content of the div, placing the ad within it.

If their code uses document.write(), though, that approach wouldn't work.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.