I am making an app in HTML5 and javascript and deploying on android device. After confirmation in the application, I don't want it to go back on previous page. But, on the back button of the device it goes on previous page.
I tried many demos. Following is one of the link I tried. http://docs.phonegap.com/en/2.8.0/cordova_events_events.md.html#backbutton
I tried displaying alert for demo purpose. But it does not work.
Please help with your suggestions. Thanks.
I tried the following. It doesn't work. Do I need to add any external jquery file?
<script type="text/javascript" charset="utf-8">
function onLoad() {
document.addEventListener("deviceready", onDeviceReady, false);
alert("On Load");
}
function onDeviceReady() {
document.addEventListener("backbutton", onBackKeyDown, false);
alert("Device Ready");
}
//document.addEventListener('backbutton', onBackKeyDown, false);
function onBackKeyDown(event) {
event.preventDefault();
alert("back pressed");
}
</script>