navigator.geolocation.getCurrentPosition不允许在“file:/// C:/”基于访问 [英] navigator.geolocation.getCurrentPosition not allowed on "file:///C:/" based access
问题描述
我一直在寻找Html 5中的地理位置。我使用Chrome(12)并使用如下路径访问html文件:file:/// C:/_Development/Examples/Html5/boilerplate.html
我在搜索栏中找到位置已被阻止追踪您的位置的小地理位置图标。
请注意,我没有任何异常设置...
这可以做到吗,还是需要将文件托管在Web服务器上? ?如果无法完成,为什么无法完成?
谢谢
b
似乎chrome在本地访问地理位置数据时存在安全限制。您需要托管文件以使用数据。上一个问题提供了python的解决方法。
Possible Duplicate:
HTML 5 Geo Location Prompt in ChromeI've been looking at geolocation in Html 5. I'm using Chrome (12) and am accessing the html file using a path like this: file:///C:/_Development/Examples/Html5/boilerplate.html
I'm getting the little geolocation icon in the search bar that says that the location has been blocked from tracking your location.
Note that I don't have any exceptions setup at all...
Can this be done or do I need to host the file on a web server? If it can't be done, why can't it be done?
Thanks
解决方案This is a duplicate of this question:
It seems that chrome has security restrictions on accessing geolocation data locally. You need to host the file to use the data. A workaround with python is available in the previous question.
这篇关于navigator.geolocation.getCurrentPosition不允许在“file:/// C:/”基于访问的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!