问题
On what basis does HTML 5 geolocation work ? Does it guess the location on the basis of IP address ? I guess it doesn't need a GPS enabled device ? I do not have GPS on my laptop.
I have been trying to test my location using HTML5 geolocation on w3schools geolocation tester/demo and html5demos but I either get location information unavailable or failed. What could be the reason for this ?
Note : I am connected to internet via USB Tethering.
回答1:
How exactly the browser does geolocation is up to it. If it has access to a GPS device, it may use that. Otherwise it may do GSM triangulation, reverse IP geolocation, WiFi network database lookups or anything else it can or can't do.
It depends on your browser/OS and is not guaranteed to work.
回答2:
It will works in most circumstances on a direct connection. However, if it connected via Proxy/VPN, sometimes it will fail to geolocate the position. Just some sharing of my last encounters found.
来源:https://stackoverflow.com/questions/13109696/why-the-html5-geolocation-fails-to-get-results