Please consider the following minimal example:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "
http://www.w3.org/
TR/html4/strict.dtd">
<html>
<head>
<script type="text/javascript" charset="utf-8" src="phonegap.js"></
script>
<script type="text/javascript" charset="utf-8">
window.onload = function()
{
document.addEventListener("deviceready", foo, true);
// window.location.href = 'next.html';
}
function foo()
{
alert('foo()'); // test if foo gets executed - always positive
window.location.href = 'next.html';
}
</script>
</head>
<body>
If you can see me, it's not working.
</body>
</html>
This code does not redirect to "next.html" on iPhone OS 3.1.3 as I
would expect. (Using "Phonegap.addConstructor" instead of the
"deviceready"-Event does not change anything.)
The redirection works if ...
1) exactly the same code is run in the Android Emulator (2.1 and 2.2)
2) the first window.location.href is uncommented
Can anyone tell me the reason for this behaviour? Is it some security
issue?