Javascript – Geolocation API

With Geolocation API, the user can provide their location to web sites. You can access it with the navigation.geolocation object.

Check if the browser supports the API:

, <span>Javascript – Geolocation API</span>, KandZ

To get the current position:

, <span>Javascript – Geolocation API</span>, KandZ
, <span>Javascript – Geolocation API</span>, KandZ
Permission popup
, <span>Javascript – Geolocation API</span>, KandZ

If you want to follow the location in case it changes then you can use the watchPosition() method. It also returns a unique id which you can use to identify the requested position.

, <span>Javascript – Geolocation API</span>, KandZ
, <span>Javascript – Geolocation API</span>, KandZ
104870cookie-checkJavascript – Geolocation APIJavascript – Geolocation API

Related posts