2013-08-29 62 views

回答

1

navigator.app僅適用於Android和Blackberry。要使用後退按鈕在Windows Phone 8中退出應用程序,您需要刪除後退按鈕事件處理程序。

function onBackKeyDown(e) { 
    e.preventDefault(); 
    window.history.go(-1); 
} 

function onPageChange() { 
    if(window.location.hash != "#/") { 
     // add our event listener for sub pages, this will allow us 
     document.addEventListener("backbutton", onBackKeyDown, false); 
    } else { 
     // remove the event listener so the back button will exit the app 
     document.removeEventListener("backbutton", onBackKeyDown, false); 
    } 
} 
+0

你可以給出一個如何完成這個代碼的例子嗎? – Aras

+0

補充,謝謝@Aras。 – funwhilelost

相關問題