【发布时间】:2015-12-17 11:00:04
【问题描述】:
我刚刚升级到 Firefox 43,我网站上的 HTML5/W3C 定位服务不再工作。
我已经检查了 release notes 的 43,但找不到任何更改的参考。
这是我用来获取当前纬度/经度位置的 JS:
// Try W3C Geolocation (Preferred)
if (navigator.geolocation) {
navigator.geolocation.getCurrentPosition(function (position) { // start of callback function for success
alert("ok");
},
function () { // start of callback function for getPos failure
alert("Unable to determine your current location");
}); // end of get position call
} else { // Browser doesn't support Geolocation
alert("Geolocation not available");
}
这是一个JSFiddle,显示在 Firefox 43 中我得到“无法确定”错误,而不是地理位置不可用...
请注意,使用上述方法,地理定位似乎在 Chrome 中仍然有效,并且 Android 上的 Firefox 43 仍然可以正常工作。
【问题讨论】:
标签: javascript html firefox geolocation