【发布时间】:2014-05-06 01:34:03
【问题描述】:
我已禁用menu.html 页面中的后退按钮。使用this
按手机上的后退按钮,我已成功退出我的应用程序。
但这会导致后退按钮在任何其他页面上都不起作用。
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";
标签: android cordova back-button navigateurl