亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

獲取當前地理位置js方法?

獲取當前地理位置js方法?

達令說 2018-10-25 14:15:34
<script type="text/javascript" >var weizhi='{$weizhi}';if(!weizhi){    var geolocation = new BMap.Geolocation();    // 創建地理編碼實例          var myGeo = new BMap.Geocoder();    geolocation.getCurrentPosition(function(r) {        if (this.getStatus() == BMAP_STATUS_SUCCESS) {            var pt = r.point;            // 根據坐標得到地址描述                myGeo.getLocation(pt,            function(result) {                console.log(result);                if (result) {                    var addComp = result.addressComponents;                                    }            });        }    });}</script>報錯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.
查看完整描述

1 回答

?
千萬里不及你

TA貢獻1784條經驗 獲得超9個贊

獲取用戶地理位置必須在一個安全的環境中。比如使用了 https 協議的頁面中。這么做主要是因為瀏覽器考慮用戶的隱私安全。

這只是一個 Warning ,現在應該在非加密協議下的頁面中還是可以使用,但將來會完全禁止。


查看完整回答
反對 回復 2018-11-26
  • 1 回答
  • 0 關注
  • 768 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號