<!DOCTYPE html>
<html>
<head>
    <title>手机精准定位</title>
    <script src="http://api.map.baidu.com/api?v=2.0&ak=fUmCszw7O7G8rBv2MO4MLLNIA5DNWLoj"></script>
    <script type="text/javascript">
        var geolocation = new BMap.Geolocation();
        geolocation.getCurrentPosition(function(r){
            if(this.getStatus() == BMAP_STATUS_SUCCESS){
                var address = r.address;
                document.getElementById("address").value = address;
            }else {
                alert('failed'+this.getStatus());
            }        
        },{enableHighAccuracy: true})
    </script>
</head>
<body>
    <input type="text" id="address" placeholder="获取当前位置">
</body>
</html
用html或php编写详细代码让手机打开的网页调用手机定位 和 百度的ak值fUmCszw7O7G8rBv2MO4MLLNIA5DNWLoj实现精准定位将获取的地址显示在输入框中

原文地址: http://www.cveoy.top/t/topic/hv8d 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录