PhoneGap Build - navigator.notification.alert not working in WP7 emulator

China☆狼群 提交于 2019-12-11 03:30:15

问题


I build this simple code with PGB, but it does not working in WP7 emulator - no alert message. For android emulator its ok. What's wrong?

    document.addEventListener("deviceready", onDeviceReady, false);
    function onDeviceReady() {
        navigator.notification.alert("Device Ready!");
    }

Source code https://github.com/dprotopopov/pgb-wp7-alert


回答1:


This seems to be a bug with the latest PhoneGap build for WP7. I have this up and running in Visual Studio and although the navigator object is accessible in the code there is no notification property available. You can test the same yourself by iterating through the properties of the navigator object in your app;

for(var key in navigator){
   document.write(key + "<br>");
}

The list I get is as follows, note that notification is not one of them :(

  • appCodeName
  • appMinorVersion
  • browserLanguage
  • cookieEnabled
  • cpuClass
  • mimeTypes
  • plugins
  • systemLanguage
  • userLanguage
  • msDoNotTrack
  • geolocation
  • appName
  • appVersion
  • platform
  • userAgent
  • onLine
  • javaEnabled
  • taintEnabled


来源:https://stackoverflow.com/questions/18042909/phonegap-build-navigator-notification-alert-not-working-in-wp7-emulator

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!