2015-06-23 68 views

回答

0
<!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> 
相關問題