[ 
https://issues.apache.org/jira/browse/CB-5488?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13965506#comment-13965506
 ] 

Garth Gutenberg commented on CB-5488:
-------------------------------------

A workaround that I've implemented (which doesn't make any sense to me, but 
maybe someone on your side can figure out why it's happening):

{code:JavaScript}
document.addEventListener( 'deviceready', function() {
        window.hasFiredDeviceReady = true;
}, false );

setTimeout( function() {
        console.log( 'Checking window.hasFiredDeviceReady' );
        if ( ! window.hasFiredDeviceReady ) {
                console.log( 'Reloading...' );
                window.location.reload();
        }
}, 10000 );
{code}

I connect Safari as fast as I can, but the first messages I see are:

{quote}
[Log] deviceready has not fired after 5 seconds. (console-via-logger.js, line 
173)
[Log] Channel not fired: onCordovaInfoReady (console-via-logger.js, line 173)
{quote}

After 10s, the page reloads and I get a full console output, including:

{quote}
[Error] TypeError: 'null' is not an object (evaluating 
'document.body.appendChild')
        createExecIframe (cordova.js, line 833)
        iOSExec (cordova.js, line 1009)
        getInfo (device.js, line 74)
        (anonymous function) (device.js, line 48)
        fire (cordova.js, line 750)
        (anonymous function) (cordova.js, line 1195)
        f (cordova.js, line 622)
        fire (cordova.js, line 750)
        (anonymous function) (cordova.js, line 1183)
        onScriptLoadingComplete (cordova.js, line 1369)
        scriptLoadedCallback (cordova.js, line 1386)

[Log] deviceready has not fired after 5 seconds. (console-via-logger.js, line 
173)
[Log] Channel not fired: onCordovaInfoReady (console-via-logger.js, line 173)
{quote}

After 10s the page reloads again... only this time the error is not thrown, and 
it loads fine.

> deviceready event not firing with jQuery Mobile
> -----------------------------------------------
>
>                 Key: CB-5488
>                 URL: https://issues.apache.org/jira/browse/CB-5488
>             Project: Apache Cordova
>          Issue Type: Bug
>          Components: iOS
>    Affects Versions: 3.1.0
>            Reporter: Federico Kereki
>            Assignee: Shazron Abdullah
>
> If you use PhoneGap + jQuery + jQuery Mobile, the deviceready event doesn't 
> fire. Googling around, I found several similar reports, all pointing out that 
> if jQuery Mobile isn't included, the event fires.



--
This message was sent by Atlassian JIRA
(v6.2#6252)

Reply via email to