The Blackberry browser on older os (<6.0) does not fire onload events or change readyState from a script. Therefore, I need to poll if the js file was uploaded successfully or not. This function, if anyone is interested.
function loadScript(path,callback,chkvar){
var a=document.createElement('script');
a.src=path;
a.type='text/javascript';
a.onreadystatechange=function(){
if(this.readyState=='complete'||this.readyState=='loaded')
callback();
};
a.onload=callback;
if(a.hasOwnProperty('onload')==false)
var e=setInterval(function(){
if(eval(chkvar)){
clearInterval(e);
callback();
}
},50);
}
document.getElementsByTagName('head').item(0).appendChild(a);
}
source
share