I have a small Phonegap app that has 2 HTML pages (index.html & error.html). When error.html is active I want the back button (hardware button on Android device) to actually go back to index.html instead of exiting the app. I have tried the following (just to trigger an even on the backbutton) with no success:
<script>
document.addEventListener("deviceready", onDeviceReady, false);
function onDeviceReady() {
console.log("PhoneGap is ready");
document.addEventListener("backbutton", onBackKeyDown, false);
}
function onBackKeyDown()
{
console.log("yes");
return false;
}
</script>
What am I missing here?