js获取经纬度
if(navigator.geolocation) { // 判断设备是否支持定位 navigator.geolocation.getCurrentPosition(function(position) { alert(position.coords.latitude); // 纬度 alert(position.coords.longitude); // 经度
·
if(navigator.geolocation) { // 判断设备是否支持定位
navigator.geolocation.getCurrentPosition(function(position) {
alert(position.coords.latitude); // 纬度
alert(position.coords.longitude); // 经度
}, function(error) {
alert(error.message);
}, {
timeout: 90000
});
}else {
alert("不支持定位");
}
更多推荐
已为社区贡献1条内容
所有评论(0)