首页 > 代码库 > js获取 gps坐标

js获取 gps坐标

if (navigator.geolocation) {
                  navigator.geolocation.getCurrentPosition(function(pos) {
                    model.address.geo = {
                      lat: pos.coords.latitude.toFixed(5),
                      lng: pos.coords.longitude.toFixed(5)
                    };
                  });
              } else {
                  alert("Geolocation is not supported by this browser.");
              }

js获取 gps坐标