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
- Instance of
- application programming interface
- Official website
- w3c.github.io/geolocation-api
Show 6 more facts
- programmed in
- ECMAScript
- work available at URL
- www.w3.org/TR/geolocation-API
- standards body
- World Wide Web Consortium
- 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
Article · Deutsch
Die W3C Geolocation API ist eine einheitliche Webbrowser-Programmierschnittstelle zum Ermitteln des geografischen Standorts des zugehörigen Endgeräts. Die API definiert eine Reihe von ECMAScript-Objekten, über die sich einmalig oder dauerhaft Informationen über die geographische Position des Geräts auslesen lassen. Die Ermittlung der Position selbst wird dabei vom Browser bzw. Betriebssystem auf dem jeweiligen Endgerät durchgeführt und ist nicht Teil der API. Die Quellen der Ortsinformationen sind dabei Geotargeting von IP-Adressen, WLAN-basierte Ortung, die Funkzelleninformation des Mobilfunknetzes (GSM/CDMA2000) oder, vor allem in Smartphones, das Global Positioning System. Da diese Quellen extreme Unterschiede in ihrer Genauigkeit aufweisen (von wenigen Metern bis hin zu etlichen Kilometern) gibt die API neben den jeweils genausten aktuell verfügbaren Positionsdaten auch einen Wert für deren Genauigkeit zurück.
Abstract from DBpedia / Wikipedia · CC BY-SA