1
我已禁用後退按鈕menu.html
頁面。使用this 我已經成功退出我的應用程序在手機上按回按鈕。Phonegap:後退按鈕不起作用
但是這會導致返回按鈕無法在任何其他頁面上工作。
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
}
}
如何在返回按鈕上連接時鏈接到菜單頁面?
有一個在你的代碼,一個巨大的錯字:'window.loacation = 「menu.html」;'應該是'了window.location = 「menu.html」;' – Hless