DeviceReady Called every time I do changePage () in Blackberry

I have an application developed on iOS and Android using phonegap 1.6.0 and JQM 1.1.0.

Now I used the same code for Blackberry. I have many pages in one HTML. I just keep changing pages. But the problem I ran into is that the device is ready to start every time I execute changePage (). This does not happen on iOS and Android ... Why is this 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>
+3
source share
2 answers

There was an error in my 9800 simulator. I installed it again, and it worked.

0
source

js . js .

//---------------------------------------------------------------------
// 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, .

0

All Articles