h5获取地理位置时报这个东西

qq_30134199 2016-08-02 06:42:49
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.

怎么解决?
...全文
841 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
smallcrocodile 2016-08-28
  • 打赏
  • 举报
回复
路过,学习哈
  • 打赏
  • 举报
回复
网站如果使用的不是安全的HTTPS协议而是HTTP,则不允许再使用getcurrentposition(),未来干脆会删除在这种情况下的支持。
要想用,换HTTPS。
qq_30134199 2016-08-02
  • 打赏
  • 举报
回复
手机端测试 有时候是 7、BMAP_STATUS_SERVICE_UNAVAILABLE 有时候没反应
qq_30134199 2016-08-02
  • 打赏
  • 举报
回复
这是代码 var x=document.getElementById("demo"); var options = {}; function getLocation(){ if (navigator.geolocation){ navigator.geolocation.getCurrentPosition(showPosition,showError,options); }else{ x.innerHTML="该浏览器不支持获取地理位置。";} } function showPosition(position){ x.innerHTML="纬度: " + position.coords.latitude + "<br>经度: " + position.coords.longitude; } function showError(error) { alert(error.code+"==="+error.message); switch(error.code) { case error.PERMISSION_DENIED: x.innerHTML="User denied the request for Geolocation." break; case error.POSITION_UNAVAILABLE: x.innerHTML="Location information is unavailable." break; case error.TIMEOUT: x.innerHTML="The request to get user location timed out." break; case error.UNKNOWN_ERROR: x.innerHTML="An unknown error occurred." break; } }

39,087

社区成员

发帖
与我相关
我的任务
社区描述
HTML5是构建Web内容的一种语言描述方式。HTML5是互联网的下一代标准,是构建以及呈现互联网内容的一种语言方式.被认为是互联网的核心技术之一。
社区管理员
  • HTML5社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧