<!DOCTYPE html>
<html>
<head>
<title>PhoneGap Back Button Example</title>
<script type="text/javascript" charset="utf-8" src="cordova-2.2.0.js"></script>
<script type="text/javascript" charset="utf-8">
// Call onDeviceReady when PhoneGap is loaded.
//
// At this point, the document has loaded but phonegap-1.2.0.js has not.
// When PhoneGap is loaded and talking with the native device,
// it will call the event `deviceready`.
//
function onLoad() {
document.addEventListener("deviceready", onDeviceReady, false);
}
// PhoneGap is loaded and it is now safe to call PhoneGap methods
//
function onDeviceReady() {
// Register the event listener
document.addEventListener("backbutton", onBackKeyDown, false);
}
// Handle the back button
//
function onBackKeyDown() {alert("back button pressed");
}
</script>
</head>
<body onload="onLoad()">
</body>
</html>
戻るボタンをクリックしたときに、ユーザーがアプリを終了するかどうかを尋ねたいです。
http://docs.phonegap.com/en/1.2.0/phonegap_events_events.md.html#backbuttonからこの例を読みまし たが、機能していません...
どうすればそれを行うことができますか?
ONDEVICEREADY 関数でアラートを設定しましたが、このメソッドが起動されないことがわかりました....だから、EVENTLISTENERE DEVICEREADY は決して起動されません...なぜ????? どうもありがとう。