I have a small problem. I want to be notified when the script has finished loading. here is my code:
var headID = document.getElementsByTagName("head")[0];
var newScript = document.createElement('script');
newScript.type = 'text/javascript';
newScript.src = 'http://code.jquery.com/jquery-1.6.2.min.js';
newScript.onreadystatechange= function () {
if (script.readyState == "loaded" || script.readyState == "complete"){
script.onreadystatechange = null;
alert("Script is ready!");
}
};
newScript.onload= function(){
alert("Script is ready 2!");
};
Everything works ok in firefox, chrome, opera but not in Internet Explorer(IE9). I found on this site that script.onreadystatechange is used by IE but it seems that is not working on IE9(I didn't tried on older versions). The script is loaded in IE but I don't receive the notification, which is important for me.
Thanks.
PS: I know there are similar questions on stackoverflow and I read them , but none of them solved my problem , or treat it in this particular way, that's why I created this one.