Dump Javascript at the end of your page

You’ve seen it plenty of times before. A website loads but only the sidebar appears. The loading graphic in your browser is still spinning and there’s that “contacting …” or “loading …” message at the bottom of your window. Why?

The most common cause of this is because the site uses a chunk of Javascript loaded from a remote site. Think of those fancy chat widgets, popups and even hit counters. If those sites are slow to load, they could make your site slow too. The best place to put that code is right at the bottom of the page, after all the content, if you can and it’s appropriate.

I just noticed this happening on Pro Blogger a few minutes ago. Darren’s stats are loaded just below the sidebar and because that site was responding slowly the main content part of his blog didn’t display immediately. This may be a storm in a teacup because the next time I refreshed it loaded fine but remember, first impressions count. You don’t want to keep a new visitor to your site waiting.

The ever pervasive seems to suffer this sort of problem on a regular basis so be extra careful when you use their Javascript applet. If it takes a while to load, so will your blog.

To further confuse matters, there’s also a bug in Firefox that makes the “Transferring data from …” message appear longer than it should. The guys at Sphere noticed this after complaints their Javascript was loading slowly. It’s all a bit of a mess really!