ページの戻るボタンを無効にしました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
}
}
戻るボタンをクリックしたときにメニューページにリンクするにはどうすればよいですか?