How can I catch which page is load when the back button click on apache cordova? I want to know after click the back button which page is load. How can I do this?
<!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>