English 中文(简体)
谷歌 Chrome如何了解我目前的全球定位系统位置以及如何在我的代码中使用该系统?
原标题:How Google Chrome knows my current GPS location and how to use it in my code?

今天,我认识到,一些网页可以找到我(如果使用手提电脑而没有 built子)使用权宜之计的黄色体,而且有极不适的精确度,即知道使用我的IP,你可以找我,但不会有这种预想。 现在,googlemap。 您将在黄色男子的顶端看到一个 but子,他们用google chrome找到你。

这项工作如何? 有一个网站?

最佳回答

实际超文本5的地勤职能(只有您的浏览器支持的话)也是可能的。

if (navigator.geolocation) {
  navigator.geolocation.getCurrentPosition(success, error);
} else {
  alert("Not Supported!");
}

function success(position) {
  console.log(position.coords.latitude);
  console.log(position.coords.longitude);
}

function error(msg) {
  console.log(typeof msg ==  string  ? msg : "error");
}

var watchId = navigator.geolocation.watchPosition(function(position) {  
  console.log(position.coords.latitude);
  console.log(position.coords.longitude);
});

navigator.geolocation.clearWatch(watchId);

Greetings, Sascha

问题回答




相关问题
Query about getting GPS Location

Is there any way to set Criteria for LocationProvider depending upon the network provider, means determining whether the network provider supports CellSite mode or autonomous mode or any other mode. ...

Android google map myLocationOverlay disappears?

I try to add myLocationOverlay to the map. It was not there at first, then when I send the gps position from the ddms, then the blue shining dot appear. However, after awhile, the blue dot disappear ...

Accessing GPS Data From a .Net Winform Application

Does anyone out there have any experience programatically retreiving the lat/long from a GPS attached to a mobile PC? A team I m on is currently looking at hardware options--as the programmer who ...

Can Google Maps plot points based on Hours Minutes Seconds

I m trying to plot out GPS data that is given to me in Hour Minute Second degree format. Will GLatLng take it in this form or do I need to convert it first. Having a hard time finding anything on the ...

热门标签