I am trying to reproduce, and I am failing. Consider this simple BB application:
package mypackage; import net.rim.device.api.browser.field2.BrowserField; import net.rim.device.api.ui.UiApplication; import net.rim.device.api.ui.container.MainScreen; public class MyApp extends UiApplication { final class MyScreen extends MainScreen { protected BrowserField browser; protected static final String URL = "http://www.craigmj.com/bbtest/index.html"; public MyScreen() { setTitle(URL); browser = new BrowserField(); add(browser); browser.requestContent(URL); } } public static void main(String[] args) { MyApp theApp = new MyApp(); theApp.enterEventDispatcher(); } public MyApp() { pushScreen(new MyScreen()); } }
Now downloadable index.html looks like this:
<html> <head> <script language="javascript" src="js1.js"></script> <script language="javascript" src="js2.js"></script> <script language="javascript" src="js2.js"></script> <script language="javascript" src="js3.js"></script> <script language="javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script> <script language="javascript"> function loadFn() { res = ""; for (var i=1; i<4; i++) { res += "js" + i + " = " + getCount("js"+i) + ", "; } document.getElementById("val").value = res; } </script> </head> <body onLoad="loadFn();"><h1>Loading...</h1> <input type="text" id="val" name="val" size="30"/> </body></html>
js1.js :
function jsCount(jsFile) { if ("undefined"==typeof window[jsFile]) { window[jsFile] = 0; } window[jsFile] = window[jsFile] + 1; } function getCount(jsFile) { return window[jsFile]; } jsCount("js1");
And js2.js and js3.js :
jsCount("js2");
and
jsCount("js3");
(You can find them at http://www.craigmj.com/bbtest/ ...)
And I get the results that I expect from a 9700 simulator, and on my 9900 device.
js1 = 1, js2 = 2, js3 = 1,
It does not work on the Blackberry 5 OS, but it looks like the BB5 browser does not support script
tags.
Can we get some information about where and how this error can be reproduced?
source share