Aim is to load a CSS via a dynamic LINK node
We also want to be notified once the CSS arrives
function CSSDone() {
alert('zOMG, CSS is done');
}
// CSS file that sleeps for one second
var url = "http://tools.w3clubs.com/pagr/1.sleep-1.css",
head = document.getElementsByTagName('head')[0];
link = document.createElement('link');
link.type = "text/css";
link.rel = "stylesheet"
link.href = url;
// MAGIC
// call CSSDone() when CSS arrives
head.appendChild(link);