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

Joany Bergeron commented on CB-7886:
------------------------------------

Thank you, switching to Cordova 3.6.0-0.2.8 resolved my problem.

> window.location.href causes a delay in the notification.confirm callback 
> [multiple pages project]
> -------------------------------------------------------------------------------------------------
>
>                 Key: CB-7886
>                 URL: https://issues.apache.org/jira/browse/CB-7886
>             Project: Apache Cordova
>          Issue Type: Bug
>    Affects Versions: 3.5.0
>            Reporter: Joany Bergeron
>
> Hi,
> I'm creating a multiple pages project with Phonegap. My project contains the 
> page index.html and connection.html. 
> Both pages contain a listener for the Back button on Android :
> document.addEventListener("backbutton", onBackKeyDown, false);
> When I press the Back button, it shows a confirmation dialog that asks me if 
> I really want to quit the app :
> function onBackKeyDown() 
> {     
>       console.log('onBackKeyDown beginning');
>       navigator.notification.confirm(
>                       'Do you really want to exit the app?',
>                       onConfirm,
>                       'Avertissement',
>                       ["No", "Yes"]
>               );
>       console.log('onBackKeyDown end');       
> }
> function onConfirm(button)
> {     
>       console.log(button);
>       if(button == 2)
>               navigator.app.exitApp();        
> }
> If I click on a link (<a href="connection.html">connection</a>) in the 
> index.html page to get to the page connection.html, everything goes fine.
> My problem is that when I get to the page connection.html by a JS redirection 
> (window.location.href='connection.html'), it creates a delay in the callback 
> of the notification.confirm.
> By using window.location.href, this is what will happen :
> 1. I click the Back button in the connection.html page
> 2. console.log : onBackKeyDown beginning
> 3. The confirmation dialog appears
> 4. console.log : onBackKeyDown end
> 5. I click No
> 6. I click the Back button again
> 7. console.log : onBackKeyDown beginning
> 8. the confirmaiton dialog appears
> 9. console.log : onBackKeyDown end
> 10. console.log : 1  (It shows the log of my previous click)
> What I want to happen :
> 1. I click the back button in the connexion.html page
> 2. console.log : onBackKeyDown beginning
> 3. The confirmation dialog appears
> 4. console.log : onBackKeyDown end
> 5. I click No
> 6. console.log : 1 (the button I pressed)
> Am I missing something? What do I need to do to make it work normally ?
> Thanks.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to