How Do I Disable The Phone's Back Button In Android Using Jquerymobile, Phonegap
Could someone please tell me how to disable Android's back button (That is the back-button found on all Android phones). I am using Jquery mobile with PhoneGap. I find this online
Solution 1:
I used backKeyDown
and it works for me :
functiononDeviceReady() {
document.addEventListener("backbutton", backKeyDown, true);
console.log("PhoneGap is ready");
}
functionbackKeyDown(d) {
navigator.app.exitApp(); // To exit the app!
e.preventDefault(); // to disable the back
}
make sure that PhoneGap is ready
!
Update: You can leave the handler empty to disable it
Solution 2:
sometimes you can get blocking Back button, sometimes not.
document.addEventListener("deviceready", onDeviceReady, false);
functiononDeviceReady() {
document.addEventListener("backbutton", function (e) {
e.preventDefault();
}, false );
}
Post a Comment for "How Do I Disable The Phone's Back Button In Android Using Jquerymobile, Phonegap"