I have an application developed on iOS & Android using phonegap 1.6.0 & JQM 1.1.0.
Now i have used the same code for blackberry. I am having many pages within a single HTML. I just keep on changing the pages. But the issue which i am facing is that, Device ready is fired everytime i perform a changePage(). This doesn’t happen in iOS and Android… Why is it happening?
Below is my code
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" id="viewport" content="width=device-width,height=device- height,initial-scale=1.0,user-scalable=no">
<script src="cordova-1.6.0.js" type="text/javascript"></script>
<script type="text/javascript" src="jquery/jquery-1.7.1.min.js"></script>
<link rel="stylesheet" href="jquerymobile/jquery.mobile-1.1.0.min.css" />
<script type="text/javascript" src="jquerymobile/jquery.mobile-1.1.0.min.js"></script>
<script type="text/javascript">
//---------------------------------------------------------------------
// Cordova event listeners
//---------------------------------------------------------------------
function onDeviceReady() {
alert("Inside Device Ready");
}
// register Cordova event listeners when DOM content loaded
function init() {
console.log('init()');
document.addEventListener("deviceready", onDeviceReady, true);
}
</script>
<title>Cordova API Sample</title>
</head>
<body onload="init()">
<div data-role="page" id="home">
<div data-role="header">
<h1>Here is the index page.</h1>
</div>
<div data-role="content">
<p><center>Below you may transition to our other pages.</center></p>
<a href="#about" data-ajax="false" data-role="button" data-inline="true">About Me</a>
</div>
</div>
<div data-role="page" id="about">
<div data-role="header">
<h1>About Us</h1>
</div>
<div data-role="content">
<a href="#home" data-ajax="false" data-role="button" data-inline="true">Back Home</a>
</div>
</div>
</body>
</html>
There was a bug in my 9800 simulator. I re-installed it and it worked.