W3C geolocation API not working on Safari 5

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-29 07:42:12

问题


W3C geolocation API doesn't seem to work in safari 5. I tried this page and it sort of tells me that Geolocation is unsuccessful.

The code: http://code.google.com/apis/maps/documentation/javascript/examples/map-geolocation.html

can somebody explain me why this is so?


回答1:


Looks like geolocation in safari only works when you're connected to wifi (not wired): Geolocation in Safari 5




回答2:


I'm using Safari 5.0.5 on Mac Snow Leopard and clicking after on your link I was getting

Error: The Geolocation service failed

Try enabling the location services in Safari.

Go to Preferences->Security and check "Allow websites to ask for location information". Also, make sure System Preferences->Security does not have "Disable Location Services" checked.

Now all works as expected and I'm getting

Location found using W3C standard



回答3:


If, like me, you're working on a Mac and none of the other answers helped, check that the Safari application is permitted to determine your location:

System Preferences --> Security and Privacy --> Privacy --> Location Services --> Check the Safari checkbox.

Refresh the page, if prompted, allow Safari to obtain your location and now you should be able to see your location on the map.

The above was reproduced on OS X El Capitan.



来源:https://stackoverflow.com/questions/5256123/w3c-geolocation-api-not-working-on-safari-5

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!