Deferring Javascript loads

Just discovered this way to speed up site loading times, by deferring the javascript:

function downloadJSAtOnload() {
var element = document.createElement(“script”);
element.src = “defer.js”;
document.body.appendChild(element);
}
if (window.addEventListener)
window.addEventListener(“load”, downloadJSAtOnload, false);
else if (window.attachEvent)
window.attachEvent(“onload”, downloadJSAtOnload);
else window.onload = downloadJSAtOnload;

The ‘defer.js’ is the name of the (non-crucial) file which you want to defer from loading at the start.

How I would use this is to:

  1. setup the basic site with all the essential theme loading elements.
  2. make note of the javascript libraries called.
  3. continue building the site with all additional plugins.
  4. check the javascript calls again, and defer all new ones.

I’ve got a few¬†of new sites to do soon, so I’ll be trying this out and will report back of the progress and how it improves things.

I found this here, btw.

Broken Themes…

now I’m all in favour of WordPress offering Themes for their .com users… but it’ll be nice if they told people whether its IE compatible or FF friendly etc. Maybe even make it a requirement that theme designers, cater for both? Cause it sure sucks that new themes break in IE 7.

btw – if anyone comments that I shouldn’t be using IE, I’ll delete it. Its not about me, a FF user, its about half the planet being very happy with their supplied browser.

wordpress: password issue?

hrm.. recently I updated my password on ‘my profile’ page… I’ve just returned today, whilst browsing to find, that same password visable for all to see in my ‘AIM’ box… how?… bearing in mind I have never an AIM id in my life and therefore never use that particular imput box, I’m thinking something dodgy happened within wordpress.com.

could be user error… however.. I just thought i’d mention it, incase anyone else noticed something odd.

btw – I have a man in my toilet, swearing at the plumbing, I think I may be peeing in the sink tonight.