Improving ad loading
If you use an ad network such as DoubleClick or Google AdWords, they will have given you code to place on your pages along the following lines:
<script src= http://adserver.js?..... ></script>
This loads some JavaScript from the ad server, which then places the actual ad on your site. Easy.
Normally, this works fine. However, the ad server is slow at times. The problem is that while the browser is waiting for the ad server, it holds off rendering the page below the ad. If there is a long delay, this will not look good.
You could prevent this by loading the ads in iframes. However, this will prevent your ad slots from showing variable-sized ads. It also creates a big empty space on your page if the ad fails to load.
A neat way to solve this problem is to load the ads after the entire page is rendered, and then move the ads to their ad slots.
In this approach, you place an empty<div>
tag at the spot where you want an ad to appear. You can give it the size...