0
我有兩個頁面:page1
和page2
PhoneGap的重定向IOS
我有問題使deviceready
事件再次觸發,當我回去page 1
。
我有這樣的代碼在page1.html
:
//Works at first
document.addEventListener("deviceready", onDeviceReadyPopup, false);
function onDeviceReadyPopup(){
window.location.href="page2.html";
}
在page2.html,我有這樣的代碼:
window.location.href="page1.html";
問題:當我回去page1.html
,deviceready
不再執行。
我認爲deviceready只會觸發一次。 看到這個答案:http://stackoverflow.com/questions/15629278/can-i-listen-for-deviceready-multiple-time-on-cordova-2-5 –
@TineUršič但我需要再次執行一些代碼在'onDeviceReadyPopup'函數內。 – JunM