1

这是我的代码:

   function onLoad(){
                alert("onLoad");
                document.addEventListener("deviceready",onDeviceReady, true);
             }

             function onDeviceReady(){
                navigator.notification.alert("PhoneGap is working!!");
                document.addEventListener("backbutton", onBackKeyDown, false);
             }


            function onBackKeyDown(e) {        
                    navigator.notification.alert("PhoneGap handle back button click!!!");
                     /* want you to go back???
                          if yes go back or exit app
                     */
            }

你能帮我做吗

/* want you to go back???

   if yes go back or exit app

*/

非常感谢。

4

2 回答 2

0
function showAlert() {
                    navigator.notification.confirm(
                        'Vuoi uscire dall\'applicazione?',  // message
                        onConfirm,              // callback to invoke with index of button pressed
                        'Chiudere?',            // title
                        'Chiudi app,Annulla'          // buttonLabels
                    );
                }

            function onConfirm(button) {
                if(button==1)           
                    navigator.app.exitApp();
            }
于 2013-04-23T10:42:37.613 回答
0

navigator.app.exitApp() 在 iOS 上不起作用 :(

继承者: https ://stackoverflow.com/a/14423091/826822

于 2013-08-21T09:33:08.523 回答