We have developed an application in jQuery integrated with android (which has only one activity). From this activity we are loading an HTML file, on this file we are showing and
Use this code in your HTML page to handle back button pressed
document.addEventListener("backbutton", onBackKeyDown, false);
function onBackKeyDown() {
// Handle the back button
}
Try this:
function onDeviceReady() {
// Add this line to the on onDeviceReady() function
document.addEventListener("backbutton", onBackKeyDown, false);
}
// Handle back button hardware
function onBackKeyDown(e) {
e.preventDefault(); // the default action of the event e should not be triggered.
history.back(1); // load the previous window.location
}