I've been trying to reproduce, and am failing. Consider this simple BB app:
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 the index.html it loads 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 is:
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 are:
jsCount("js2");
and
jsCount("js3");
(You can find them at http://www.craigmj.com/bbtest/...)
And I'm getting the results I expect on the 9700 simulator, and on my 9900 device.
js1 = 1, js2 = 2, js3 = 1,
It doesn't work on the Blackberry 5 OS, but that appears to be because the browser on BB5 doesn't support script
tags.
Can we get some clarity on exactly where and how this error can be reproduced?
<script>
elements)? – Tonality