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