iOS9更新后,navigator.geolocation.getCurrentPosition不再适用于Safari移动版 [英] navigator.geolocation.getCurrentPosition no longer working in Safari mobile after iOS9 update

查看:877
本文介绍了iOS9更新后,navigator.geolocation.getCurrentPosition不再适用于Safari移动版的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

  if(navigator.geolocation){
navigator.geolocation.getCurrentPosition(function(position){

但是现在我更新到iOS9它已停止工作我甚至没有获得Safari提示请求获取我的位置的权限任何其他人在更新到iOS9之后发生此问题并且能够解决它?


$ b


getCurrentPosition()和watchPosition()在不安全的
原点上被弃用,支持将会您应该
考虑将您的应用程序切换到一个安全的来源,例如HTTPS
请参阅 https://goo.gl/rStTGz 了解更多详情。



I have a web app that has this code for getting the user's coordinates:

if (navigator.geolocation) {
   navigator.geolocation.getCurrentPosition(function(position) {  

But the moment I updated to iOS9 it ceased to work. I'm not even getting the Safari prompt anymore asking permission to get my location. Anyone else having this issue after updating to iOS9 and was able to resolve it?

解决方案

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.

这篇关于iOS9更新后,navigator.geolocation.getCurrentPosition不再适用于Safari移动版的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆