incubator-callback-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Filip Maj (Created) (JIRA)" <>
Subject [jira] [Created] (CB-551) deviceready is fired every time changePage() is called in jQuery Mobile within a single-page app
Date Fri, 20 Apr 2012 15:52:40 GMT
deviceready is fired every time changePage() is called in jQuery Mobile within a single-page

                 Key: CB-551
             Project: Apache Callback
          Issue Type: Bug
          Components: BlackBerry
    Affects Versions: 1.6.0
            Reporter: Filip Maj
            Assignee: Filip Maj
             Fix For: 1.7.0

Taken from

Single page app. When switching view divs, something triggers deviceready to be called again.
Likely something to do with the {{location.href}} changing. Probably shouldn't be happening.

Example code:

<!DOCTYPE html>
<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/" />
<script type="text/javascript" src="jquerymobile/"></script>
<script type="text/javascript">

    // Cordova event listeners

   function onDeviceReady() {
    alert("Inside Device Ready");

    // register Cordova event listeners when DOM content loaded
    function init() {
        document.addEventListener("deviceready", onDeviceReady, true); 

<title>Cordova API Sample</title>
<body onload="init()">

   <div data-role="page" id="home">
<div data-role="header">
<h1>Here is the index page.</h1>

<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 data-role="page" id="about">
<div data-role="header">
<h1>About Us</h1>

<div data-role="content">
<a href="#home" data-ajax="false" data-role="button" data-inline="true">Back Home</a>

This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators:!default.jspa
For more information on JIRA, see:


View raw message