W3C Geolocation API
Sign in to saveJavaScript API to geolocate devices
Source code
Once a user grants permission, Geolocation provides access to geographical location information from device. Editor's draft This HTTPs-only API exposes the navigator.geolocation object with a couple of useful methods: .getCurrentPosition(successCallback, [errorCallback, options]) - "one shot" position request .watchPosition(successCallback, [errorCallback, options]) - Watch a position and get notified of any changes. .clearWatch(someId) - allows you to stop watching for location changes. No location information is made available through this API without the user's permission. Request the user's current location. If the user allows it, you will get back a position object. Request the ability to watch user's current location. If the user allows it, you will get back continuous updates of the user's position.
Excerpt from the source-code README · 2,442 chars · not written by Vinony
Wikidata facts
- Official website
- w3c.github.io/geolocation-api
Show 4 more facts
- work available at URL
- www.w3.org/TR/geolocation-API
- Stack Exchange tag
- stackoverflow.com/tags/w3c-geolocation
- source code repository URL
- github.com/w3c/geolocation
- software version identifier
- REC-geolocation-20250411
Sources (3)
via Wikidata · CC0