12-19-2012 05:11 AM
Hi,
I tried to load webwork.js dynamically like this:
var script = document.createElement('script');
script.src='local:///chrome/webworks.js';
script.type= "text/javascript";
document.getElementsByTagName('head')[0].appendChi
but then the webworksready event is never fired. It works if I put directly:
<script type="text/javascript" src="local:///chrome/webworks.js"></script>
Is there a way to load webwork.js conditionally? (only if the platform is BB)
Thanks.
12-19-2012 09:22 AM
Hi, In that case, you need to register for webworksready after the script loads:
script.onload = function () {
document.addEventListener("webworksready", function () {
//do something
});
};
12-19-2012 09:38 AM
Thanks, I'll try it if I encounter this problem again. In the meantime I've changed our build process to have an HTML file with a "classic" <script /> tag for BlackBerry OS 10.