navigator.geolocation.getCurrentPosition no longer working in Safari mobile after iOS9 update

限于喜欢 提交于 2019-12-06 13:46:21

I've noticed this myself and i'm wondering if iOS 9 Webkit has started to prevent this working via HTTP as I know Chrome will be preventing this shortly as it currently throws the following alert in the web console.

getCurrentPosition() and watchPosition() are deprecated on insecure origins, and support will be removed in the future. You should consider switching your application to a secure origin, such as HTTPS. See https://goo.gl/rStTGz for more details.

Try enabling localization in the general settings of iOS. Settings > Localization > Press localization to enable it. And now it works.

It seems that iOS 9 has disabled localization in the settings, after installing.

If you are running on a mac, you'll need to enable location services for safari: enable location on OSX

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