I am on blackberry9300 (5.0.0.832). And I am trying to add a javascript element programmatically.
var script=document.createElement('script');
script.src='file.js';
script.type='text/javascript';
script.onload=function(){alert('loaded');}; //Nothing happens
script.addEventListener('load', function(){alert('loaded');}, false); //Nothing happens
script.addEventListener('readystatechange', function(){alert('state changed');}, false); //Nothing happens
script.onreadystatechange=function(){alert('state changed')}; //Nothing happens
document.getElementsByTagName('head').item(0).appendChild(script);
Is there any way to workaround this issue?
blackberry browser on older os (< 6.0) doesn’t fire onload events or doesn’t change readyState of script. So I need to poll if js file is loaded successfully or not. Here is that function if anybody is interested.