Reputation: 306
Staff helps me in this here... I am looking to the backbutton function, but already tried some form and all make the application exit. In emulate was already working. I do following:
function onLoad() {
document.addEventListener("deviceready", onDeviceReadyBack, false);
}
// device APIs are available
//
function onDeviceReadyBack() {
// Register the event listener
document.addEventListener("backbutton", onBackKeyDown, false);
}
// Handle the back button
//
function onBackKeyDown() {
window.history.back();
//alert("entro aqui");
}
How do not exit the application ?
Upvotes: 0
Views: 41
Reputation: 578
You should call e.preventDefault()
in the backbutton
event, like that :
document.addEventListener("deviceready", onDeviceReady, false);
function onDeviceReady() {
document.addEventListener("backbutton", function (e) {
e.preventDefault();
}, false );
}
Upvotes: 1