I am trying to create a phonegap application for Windows Phone 7. I am trying to execute documentation for the "backbutton" event (http://docs.phonegap.com/en/2.0.0/cordova_events_events.md. Html # backbutton), but I can not force its work.
The "deviceready" event fires, but the "backbutton" event does not work. When compiling and starting the Windows Phone Windows Phone emulator, the onDeviceReady function is called and the "Device is ready" is written, but when you press the emulator return button, the application logs out and does not register to the console. When the back button is pressed, the OnBackKeyDown function should work.
copy of code from official document:
<html>
<head>
<script type="text/javascript" charset="utf-8" src="cordova-2.0.0.js"></script>
<script type="text/javascript">
function onLoad() {
document.addEventListener("deviceready", onDeviceReady, false);
}
function onDeviceReady() {
console.log("Device ready");
document.addEventListener("backbutton", onBackKeyDown, false);
}
function onBackKeyDown() {
console.log("Back button pressed");
}
</script>
</head>
<body onload="onLoad()">
<div></div>
</body>
</html>