This seems like a great time to subscribe my RSS !

Some days ago, our ads engine was behaving the (very) wrong way.Randomly, all of our sites were taking a 1-2 minutes to load a page. It turned out some of our insertionist server was down, thus delaying request’s response for ages, and -afterwards- giving up.

It turned out our banner service provider was using document.write to render the banners on the page. How bad !


Like many others, we use a third-party advertising service to feed up our Ads. The javascript we had to embed in our pages was something like this

<script language="javascript">


document.write('<scr'+'ipt language="javascript1.1" src="http://[replaced-host]/[replaced-webpage?get-params]"></scri'+'pt>');



<noscript> --- nothing interesting --- </noscript>

Copy pasting the evalueted-resulting in firefox I got a long script which purpose was to write into document the requested banner using document.write.

Why it is so bad ?


  • Because inline scripts force user’s browser to wait for the code to complete (even if we have to wait for an external url to load) before rendering the rest of page.

  • Because we can’t further process (modify/duplicate etc) the output before embedding it in the actual webpage.

  • Also they bloat the xhtml code (this is where Behaviours went from)


It took some hour to came up with my own solution (which I won’t explain, mainly cause is in the office’s PC so I don’t have at hand right now).

Anyway it feels good to see other people had the same problem and came up with handy solutions (warning: I didn’t test that code).

Further Reading

No Comments Yet.

Leave a comment