Skip to content
EntityQ1585009· pop 7· linked from 228 articles

W3C Geolocation API

Sign in to save

JavaScript 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

Show 4 more facts
work available at URL
www.w3.org/TR/geolocation-API
source code repository URL
github.com/w3c/geolocation
software version identifier
REC-geolocation-20250411
Sources (3)

via Wikidata · CC0

Available in 7 languages

via Wikidata sitelinks · CC0

Connections

Categories