JavaScript Geolocation API
- Previous Page API Fullscreen
- Next Page API History
Geolocation object
The Geolocation object allows users to provide their location to web applications. For privacy reasons, users will be required to allow reporting of location information.
Note:This feature is only available in a secure context (HTTPS).
Note:For devices with GPS such as iPhone, the geographic location is most accurate.
The Geolocation API is published through the navigator.geolocation object.
Geolocation object property
Property | Description |
---|---|
coordinates | Return the location and altitude of the device on Earth. |
position | Return the position of the device at a given time. |
positionError | Return the cause of the error that occurred when using the geolocation device. |
positionOptions | Description of an object containing the options property, which is passed as a parameter to Geolocation.getCurrentPosition() and Geolocation.watchPosition(). |
Geolocation object method
Method | Description |
---|---|
clearWatch() | Deregister the previously installed location/error watcher for Geolocation.watchPosition(). |
getCurrentPosition() | Return the current position of the device. |
watchPosition() | Return the listening ID value, then pass it to the Geolocation.clearWatch() method to be used for logout processing. |
- Previous Page API Fullscreen
- Next Page API History