<script>
  /*
   获取经纬度
   */
  navigator.geolocation.getCurrentPosition(
    function(p){
      console.log("经度:"+p.coords.latitude+"\n纬度:"+p.coords.longitude)
    },
    function(e){
      console.log(e.code)
    }
  )
  /*
   持续获取经纬度
   */
  navigator.geolocation.watchPosition(
    function(p){
      console.log("经度:"+p.coords.latitude+"\n纬度:"+p.coords.longitude)
    },
    function(e){
      console.log(e.code)
    }
  )
</script>