Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How HTML5 Geolocation Feature Works?

Tags:

How can the browser tell where I am?

Totally based on registered IP address? What if I'm behind a proxy?

like image 282
Morgan Cheng Avatar asked Apr 15 '10 00:04

Morgan Cheng


People also ask

What is geolocation in HTML5 How does HTML5 geolocation work explain with the help of code snippet?

HTML5 Geolocation API lets you share your location with your favorite web sites. A JavaScript can capture your latitude and longitude and can be sent to backend web server and do fancy location-aware things like finding local businesses or showing your location on a map. var geolocation = navigator.

How does a geolocation work?

Since devices are used by individuals, geolocation uses positioning systems to track an individual's whereabouts down to latitude and longitude coordinates, or more practically, a physical address. Both mobile and desktop devices can use geolocation.

How does JavaScript geolocation work?

The Geolocation API is accessed via a call to navigator. geolocation ; this will cause the user's browser to ask them for permission to access their location data. If they accept, then the browser will use the best available functionality on the device to access this information (for example, GPS).


1 Answers

That would depend on the browser and its settings. It might use GPS, WLAN AP-based location, IP location, or any other conceivable method of locating itself.

The browser runs on your local machine, so even if you're behind a proxy, it should be able to find your actual IP address (unless security features prevent it from being sent for lookup to a geolocation server). Whether any browser is smart enough to handle being behind a NAT (with the local machine having a private IP) and looking up the gateway's IP address, that I don't know.

like image 125
Matti Virkkunen Avatar answered Oct 12 '22 02:10

Matti Virkkunen