How does a browser get GPS data from a computer?

[亡魂溺海] 提交于 2019-12-01 03:30:50

问题


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.


回答1:


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



回答2:


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.



来源:https://stackoverflow.com/questions/7378061/how-does-a-browser-get-gps-data-from-a-computer

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!