Is it possible to know when a script injected via document.write has finished loading?
document.write('<script src="' + url + '"><\/script>');
This is executed on page load.
Edit:
Thanks for all the help guys, really helped point me toward the right direction. I ended up using this solution from MSDN
s = document.createElement("script");
s.src="myscript.js";
if(s.addEventListener) {
s.addEventListener("load",callback,false);
}
else if(s.readyState) {
s.onreadystatechange = callback;
}
document.body.appendChild(s);
function callback() { console.log("loaded"); }