单击 apache cordova 上的后退按钮时,如何捕获正在加载的页面?
How can I catch which page is load when the back button click on apache cordova?
当单击 apache cordova 上的后退按钮时,我如何捕捉正在加载的页面?
我想知道点击后退按钮后加载了哪个页面。我该怎么做?
<!DOCTYPE html>
<html>
<head>
<title>Back Button Example</title>
<script type="text/javascript" charset="utf-8" src="cordova.js"></script>
<script type="text/javascript" charset="utf-8">
// Wait for device API libraries to load
//
function onLoad() {
document.addEventListener("deviceready", onDeviceReady, false);
}
// device APIs are available
//
function onDeviceReady() {
// Register the event listener
document.addEventListener("backbutton", onBackKeyDown, false);
}
// Handle the back button
//
function onBackKeyDown() {
//console your current page location
console.log("Page location is " + window.location.href);
}
</script>
</head>
<body onload="onLoad()">
</body>
</html>
当单击 apache cordova 上的后退按钮时,我如何捕捉正在加载的页面? 我想知道点击后退按钮后加载了哪个页面。我该怎么做?
<!DOCTYPE html>
<html>
<head>
<title>Back Button Example</title>
<script type="text/javascript" charset="utf-8" src="cordova.js"></script>
<script type="text/javascript" charset="utf-8">
// Wait for device API libraries to load
//
function onLoad() {
document.addEventListener("deviceready", onDeviceReady, false);
}
// device APIs are available
//
function onDeviceReady() {
// Register the event listener
document.addEventListener("backbutton", onBackKeyDown, false);
}
// Handle the back button
//
function onBackKeyDown() {
//console your current page location
console.log("Page location is " + window.location.href);
}
</script>
</head>
<body onload="onLoad()">
</body>
</html>