Javascript GeoLocation is not working on Chrome(Javascript GeoLocation 在 Chrome 上不起作用)
问题描述
我正在尝试获取用户的地理位置,然后进行查询.在 Mozilla Firefox 中,它在 Safari 中也可以正常工作......但在 Chrome 中它根本不起作用.
I'm trying to take the geolocation of the User and then do a query. In Mozilla Firefox it works fine also in Safari.... but in Chrome it doesnt work at all.
我得到 error 1
但我没有拒绝任何请求,实际上弹出窗口根本没有出现.
But i haven't denied any request, actually the popup window doesnt come up at all.
我已转到 Chrome 设置 > 显示高级 > 隐私 > 内容设置 > 位置允许所有人.
I've went to Chrome Settings > Show advanced > Privacy > Content Settings > Location allow for all.
重新启动 chrome 并没有发生任何事情.我确定我的代码是 100% 合法的,所以有人知道如何处理吗?谢谢!
Restarted chrome and nothing happened. I'm sure my code is 100% legit so does anyone know how to deal with it? Thanks!
推荐答案
好的,这很容易...... Chrome 自 2016 年 4 月 20 日起禁用了不安全网站的 Geolocation API(没有 https)......链接在这里
Ok this was quite easy... Chrome since 20 of April 2016 has disabled the Geolocation API for insecure websites (without https)... link here
https://developers.google.com/web/updates/2016/04/geolocation-on-secure-contexts-only
所以别担心..
这篇关于Javascript GeoLocation 在 Chrome 上不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!