Safari 5 中的地理位置
我有一个使用 HTML5 地理位置报告我的位置的应用程序.该应用程序在 Firefox 和 Chrome 上运行正常,但在 Safari 5 上,它说 Safari 不支持地理定位.
I have a application which reports my location using HTML5 geolocation. The application works correct on Firefox and Chrome, but on Safari 5, it says that Safari does not support Geolocation.
根据我的阅读,Safari 5 确实支持地理定位.我错过了什么?
From what I read, Safari 5 does support Geolocation. What am I missing?
感谢您的宝贵时间.
苏尼尔
推荐答案
看起来 Safari 地理位置只有在连接 wifi 时才有效.当通过有线连接连接时,Safari 会从地理定位函数调用错误回调.
Looks like Safari geolocation only works when connected with wifi. When connected with a wired connection Safari calls the error callback from the geolocation functions.
要对此进行测试,请在 Web 控制台中尝试:
To test this, try this in the web console:
navigator.geolocation.getCurrentPosition(
function(){console.log("success")},
function(){console.log("error")}
);
对于 Safari/wifi,它会在一两秒后返回成功",但在有线连接上它会立即返回错误".
With Safari/wifi this returns 'success' after a second or two, but on a wired connection it returns 'error' immediately.
(使用 Safari 5.1 - 8.x/Mac OSX 10.7 - 10.10)
( using Safari 5.1 - 8.x / Mac OSX 10.7 - 10.10 )
相关文章