I tried to implement the functionality of the back button in my wp8 cordova application, which, when I click the back button on the device, should go to the previous page of the application.
What I've done
function onLoad() {
document.addEventListener("deviceready", init, false);
document.addEventListener("resume", onResume, false);
document.addEventListener("backbutton", onBackKeyDown, false);
}
function init() {
}
function onResume() {
}
function onBackKeyDown() {
window.history.back();
return false;
}
I also tried replacing "window.history.back ();" with "navigator.app.backHistory ();" which also doesn't seem to work
Then I tried to put the code in a catch catch block
try
{
navigator.app.backHistory();
//window.history.back();
}
catch (e)
{
console.log("exception: " + e.message);
}
which also seems to fail. Be that as it may, the application seems to exit the application rather than moving backward, and the funny thing is, when I try to do this on the IE console, it seems to work fine.
Help with the guys
Thanks in advance