2012-02-16 141 views
3

我在使用jQuery mobile(1.0.1。)的Windows Phone 7.5上試用PhoneGap 1.4。 基本導航工作,不幸的是我似乎無法得到警報工作。無論是alert(「string」)還是PhoneGap的navigator.notification.alert(message,alertCallback,[title],[buttonName]);都不會給我任何迴應PhoneGap測試信息顯示正常,這是我嘗試撥打電話的方式它:alert()不能在Windows Phone上使用PhoneGap

function init() 
{ 
    document.addEventListener("deviceready",onDeviceReady,false); 
} 

function onDeviceReady() 
{ 
    document.getElementById("welcomeMsg").innerHTML += "PhoneGap is ready!"; 
    alert('test'); 
    navigator.notification.alert(
     'You are the winner!', // message 
     alertDismissed,   // callback    
     'Game Over',   // title    
     'Done'     // buttonName   
); 
} 
+1

http://groups.google.com/group/phonegap/browse_thread/thread/e3053e90aaf4890b – ghostCoder 2012-02-16 12:45:35

+0

謝謝,就是這樣。奇怪的是,navigator.notification.alert()的所有選項如上所述(從phonegap主頁複製)不起作用... – Thomas 2012-02-16 12:58:21

+0

嗯,它是奇怪的。接受n關閉然後 – ghostCoder 2012-02-16 13:24:28

回答

5

看到這個Google Groups discussion

總之,Windows Phone 7的IE9瀏覽器不支持的警報,而是必須使用PhoneGap的通知API,像這樣:

navigator.notification.alert("Message", callBackMethod, "Title", "Button Text"); 

欲瞭解更多信息,請參閱PhoneGap Notification API

+0

奇怪,但這個例子不適用於我的WP 7.8和WP 8.我使用PhoneGap 3.4.0。問題描述:http://stackoverflow.com/questions/18042909/phonegap-build-navigator-notification-alert-not-working-in-wp7-emulator/18731585#18731585 – 2014-04-11 13:38:52

相關問題