1

我已禁用menu.html页面中的后退按钮。使用这个 我已经成功退出我的应用程序按下手机上的后退按钮。

但这会导致后退按钮在任何其他页面上都不起作用。

function onDeviceReady() {
    document.addEventListener("backbutton", onBackKeyDown, false); //Listen to the User clicking on the back button
}

Menu.html单击手机上的后退按钮时,我想导航到页面。我试过这个但失败了。

function onBackKeyDown(e) {
    e.preventDefault();
    navigator.notification.confirm("Are you sure you want to go to Menu page?", onConfirm, "Confirmation", "Yes,No"); 
    // Prompt the user with the choice
}

function onConfirm(button) {
    if(button==2){//If User selected No, then we just do nothing
        return;
    }else{
        window.loacation="menu.html";// Otherwise navigate to Menu Page
    }
}

单击后退按钮时如何链接到菜单页面?

4

1 回答 1

2

尝试使用window.location.replace("menu.html")

于 2014-03-27T08:25:54.897 回答