codeDevotee

直接上代码:

if(navigator.geolocation) {
    navigator.geolocation.getCurrentPosition(
        function (position) {  
            var longitude = position.coords.longitude;  
            var latitude = position.coords.latitude;  
            console.log(longitude)
            console.log(latitude)
            },
            function (e) {
             var msg = e.code;
             var dd = e.message;
             console.log(msg)
             console.log(dd)
        }
      ) 
   }

 

效果如下:

 

分类:

技术点:

相关文章:

  • 2021-12-18
  • 2021-11-21
  • 2021-07-27
  • 2022-02-09
  • 2022-02-23
  • 2022-12-23
猜你喜欢
  • 2022-01-01
  • 2021-12-22
  • 2021-12-22
  • 2022-01-12
  • 2022-01-01
  • 2021-12-22
  • 2021-11-01
相关资源
相似解决方案