navigator.geolocation.getCurrentPosition not allowed on quot;file:///C:/quot; based access(“file:///C:/上不允许 navigator.geolocation.getCurrentPosition基于访问)
问题描述
可能重复:
Chrome 中的 HTML 5 地理位置提示
我一直在查看 Html 5 中的地理位置.我正在使用 Chrome (12) 并使用如下路径访问 html 文件:file:///C:/_Development/Examples/Html5/boilerplate.html
I'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?
谢谢
推荐答案
这是这个问题的重复:
Chrome 中的 HTML 5 地理位置提示
chrome 似乎对本地访问地理位置数据有安全限制.您需要托管文件才能使用数据.上一个问题中提供了使用 python 的解决方法.
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.
这篇关于“file:///C:/"上不允许 navigator.geolocation.getCurrentPosition基于访问的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:“file:///C:/"上不允许 navigator.geolocation.getCurrentPosition基于访问


基础教程推荐
- jQuery File Upload - 如何识别所有文件何时上传 2022-01-01
- 每次设置弹出窗口的焦点 2022-01-01
- 如何使用sencha Touch2在单页中显示列表和其他标签 2022-01-01
- Node.js 有没有好的索引/搜索引擎? 2022-01-01
- 什么是不使用 jQuery 的经验技术原因? 2022-01-01
- 如何在特定日期之前获取消息? 2022-01-01
- WatchKit 支持 html 吗?有没有像 UIWebview 这样的控制器? 2022-01-01
- 为什么我在 Vue.js 中得到 ERR_CONNECTION_TIMED_OUT? 2022-01-01
- Javascript 在多个元素上单击事件侦听器并获取目标 2022-01-01
- 如何使用 CSS 显示和隐藏 div? 2022-01-01