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 に答える