HTML5 的 geolocation 警告提示?

使用HTML5的geolocation时,chrome的控制提示如下:

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.

这是什么意思?没看明白,求解答。

阅读 20.2k
1 个回答

翻译一下:getCurrentPosition() 和 watchPosition()这两个方法在不安全的环境下不建议使用,在以后的规范可能不会支持。你应该考虑appliaction的安全性,比如使用https。详细情况请看https://goo.gl/rStTGz
PS:因为获取位置信息,以及监控位置的变化这些操作都属于敏感性操作,所以browsers在执行都会非常谨慎。它需要你在安全的环境并且获取用户的同意才会执行。

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题