How do I disable Android Back button on one page and change to exit button on every other page

前端 未结 4 949
北海茫月
北海茫月 2020-12-16 15:37

I am developing an Android application using Phonegap that interacts with my Drupal site. I have re-assigned the Android \"Back\" button to prompt the user to log off from t

4条回答
  •  囚心锁ツ
    2020-12-16 16:06

    Try this:

    document.addEventListener("backbutton", function(e){
        if($.mobile.activePage.is('#login_page')){
            e.preventDefault();
        }
        else {
            if (confirm("Are you sure you want to logout?")) {
                /* Here is where my AJAX code for logging off goes */
            }
            else {
                return false;
            }
        }
    }, false);
    

提交回复
热议问题