js获取⽤户实时地理位置
if(navigator.geolocation) {
var id = navigator.geolocation.watchPosition(function(position){
console.log(\"纬度\" + position.coords.latitude + \"经度\" + position.coords.longitude) }, function(err){
switch(err.code) {
case err.PERMISSION_DENIED: return \"PERMISSION_DENIED\";
case err.POSITION_UNAVAILABLE: return \"POSITION_UNAVAILABLE\"; case err.TIMEOUT: return \"TIMEOUT\"; default: return \"UNKNOWN_ERROR\"; } })
// navigator.geolocation.clearWatch(id); 停⽌监视}else {
console.log(\"你的浏览器不⽀持geolocation\");}
因篇幅问题不能全部显示,请点此查看更多更全内容
Copyright © 2019- yrrf.cn 版权所有 赣ICP备2024042794号-2
违法及侵权请联系:TEL:199 1889 7713 E-MAIL:2724546146@qq.com
本站由北京市万商天勤律师事务所王兴未律师提供法律服务