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