[英]GeoLocation API error handling
So I have this code... problem is that when Firefox asks me for my location, and I reject it, it never runs the error function. 所以我有这段代码...问题是,当Firefox询问我我的位置而我拒绝它时,它永远不会运行错误功能。 Why?
为什么?
if (navigator.geolocation) {
navigator.geolocation.getCurrentPosition(savePosition, noPosition);
} else { noPosition(null); }
function savePosition(position) {
current.latitude = position.coords.latitude;
current.longitude = position.coords.longitude;
}
function noPosition(error) {
alert("Aaa");
}
正如您在此处看到的那样,这是一个错误: https : //bugzilla.mozilla.org/show_bug.cgi?id=675533
It looks like this is the current behavior of Firefox. 看起来这是Firefox的当前行为。 The same happens when you try their example on this page: https://developer.mozilla.org/en-US/docs/WebAPI/Using_geolocation
当您在此页面上尝试其示例时,也会发生相同的情况: https : //developer.mozilla.org/en-US/docs/WebAPI/Using_geolocation
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.