incubator-callback-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Shazron Abdullah (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (CB-950) navigator.notification.alert not working outside onDeviceReady on 5.1 sdk
Date Thu, 21 Jun 2012 23:21:42 GMT

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

Shazron Abdullah commented on CB-950:
-------------------------------------

Adding code "at particular moments in the page" won't work, since it will wait for the deviceready
event (thus async), and this will occur after the DOM is loaded, so it won't do what you think
it will do.

Thus, the whole page will be loaded first, then the deviceready fires.

You can try, but it won't have the desired effect that I think you want:
{code}
document.addEventListener("deviceready", function() {
    navigator.notification.alert("Cordova is working!");
}, false);
{code}
                
> navigator.notification.alert not working outside onDeviceReady on 5.1 sdk
> -------------------------------------------------------------------------
>
>                 Key: CB-950
>                 URL: https://issues.apache.org/jira/browse/CB-950
>             Project: Apache Cordova
>          Issue Type: Bug
>          Components: iOS
>    Affects Versions: 1.8.1
>         Environment: Xcode 4.3.3 iOS 5.1 simulator
>            Reporter: Diogo Lima
>            Assignee: Shazron Abdullah
>              Labels: ios, ios5.1
>         Attachments: index.html
>
>
> navigator.notification.alert working only if is inside onDeviceReady, is not working
outside. I notice that is working after a reload using document.location = "index.html".
> I have created a new project, then the message "Cordova is working!" appears as usual,
but when moving it to another <script> block, it's not working.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Mime
View raw message