Safari 5中的地理定位 [英] Geolocation in Safari 5

查看:129
本文介绍了Safari 5中的地理定位的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个使用HTML5地理位置报告我的位置的应用程序。该应用程序在Firefox和Chrome上运行正常,但在Safari 5上,它表示Safari不支持地理位置。

据我所知,Safari 5支持地理位置。我缺少什么?



感谢您的宝贵时间。



Sunil

解决方案

看起来像Safari的地理定位只适用于连接无线网络。当连接到有线连接时,Safari会从地理位置函数中调用错误回调函数。



要测试这个,请在​​Web控制台中试试这个:

  navigator.geolocation.getCurrentPosition(
function(){console.log(success)},
function(){console。日志(错误)}
);

使用Safari / wifi会在一两秒后返回'成功',但在有线连接上立即返回'错误'。



(使用Safari 5.1 - 8.x / Mac OSX 10.7 - 10.10)

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.

From what I read, Safari 5 does support Geolocation. What am I missing?

Thanks for your time.

Sunil

解决方案

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.

To test this, try this in the web console:

navigator.geolocation.getCurrentPosition(
  function(){console.log("success")},
  function(){console.log("error")}
);

With Safari/wifi this returns 'success' after a second or two, but on a wired connection it returns 'error' immediately.

( using Safari 5.1 - 8.x / Mac OSX 10.7 - 10.10 )

这篇关于Safari 5中的地理定位的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆