Geolocation in Safari 5(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 )
这篇关于Safari 5 中的地理位置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:Safari 5 中的地理位置
基础教程推荐
- Javascript 在多个元素上单击事件侦听器并获取目标 2022-01-01
- WatchKit 支持 html 吗?有没有像 UIWebview 这样的控制器? 2022-01-01
- 如何使用 CSS 显示和隐藏 div? 2022-01-01
- jQuery File Upload - 如何识别所有文件何时上传 2022-01-01
- 如何使用sencha Touch2在单页中显示列表和其他标签 2022-01-01
- Node.js 有没有好的索引/搜索引擎? 2022-01-01
- 为什么我在 Vue.js 中得到 ERR_CONNECTION_TIMED_OUT? 2022-01-01
- 每次设置弹出窗口的焦点 2022-01-01
- 什么是不使用 jQuery 的经验技术原因? 2022-01-01
- 如何在特定日期之前获取消息? 2022-01-01
