在 iOS 10 上尝试在 safari 中获取地理位置时出错

Got an error when trying to get the geolocation in safari on iOS 10

[已阻止] 由于与 http://www.hnsjb.cn 的不安全连接,对地理定位的访问被阻止。

我应该将我的网站更改为 https 协议吗?

我找不到任何特定于 Safari 的指南,但其他网络浏览器也讨论过这个问题。

特别是关于 Google Chrome 通过不安全连接阻止地理定位的公告,于 2016 年 4 月在 developers.google.com 上发布,在最后一段“我真的需要使用地理定位”下.我该怎么办?”,建议:

If you would like to use the HTML5 Geolocation API, or if your site already uses the Geolocation API, please migrate the pages making Geolocation API calls to HTTPS, ensuring that they’re used in a secure context.

iOS 10 和桌面 Safari 10 现在似乎需要 https 连接。 Safari 似乎也比 Chrome 之前做的更严格。不允许混合内容警告,Chrome 允许例如地图图块以通过普通 http 加载。