开发者

How does a browser get GPS data from a computer?

HTML5 browser can retrive the gps position of a computer. http://diveintohtml5.ep.io/geolocation.html开发者_运维技巧

I would like to create an application that fakes a GPS device, but I couldn't read anywhere how the browser gets GPS data from the computer.


Chrome and Firefox:

  • GPS via gpsd if available (Linux only) 1, 2
  • system's Location API (Windows 7 only) 2
  • WiFi networks via Google Location Services 1


GPS coordinates are available only on mobile browsers. What you are discussing is geolocation generally. Your dekstop or laptop computer does not have GPS device. Locations are expressed in latitude and longitude.

For iOS use iOS emulator. You can set fake GPS coordinates. You can download it from developer.apple.com.

For Android use Android emulator. You can set fake GPS coordinates. Google Android SDK.

For other browsers / mobile vendors download the corresponding emuator.

Desktop browsers do not use GPS data. They use either IP based or WLAN based locationing. For desktop browsers just write your own test stub for navigator.geolocation.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜