Geolocation
Обновлено: 09.03.2023
Об'єкт геолокації
Об’єкт Geolocation дозволяє користувачеві надавати веб-додаткам своє місцезнаходження. З міркувань конфіденційності користувач запитує дозвіл повідомляти інформацію про місцезнаходження.
Примітка. Ця функція доступна лише в безпечних контекстах (HTTPS).
Примітка. Геолокація найточніша для пристроїв із GPS, як-от iPhone.
API геолокації публікується через об’єкт navigator.geolocation.
Властивості та методи об'єкта геолокації
| Property/Method | Description | 
| coordinates | Returns the position and altitude of the device on Earth | 
| position | Returns the position of the concerned device at a given time | 
| positionError | Returns the reason of an error occurring when using the geolocating device | 
| positionOptions | Describes an object containing option properties to pass as a parameter of Geolocation.getCurrentPosition() and Geolocation.watchPosition() | 
| clearWatch() | Unregister location/error monitoring handlers previously installed using Geolocation.watchPosition() | 
| getCurrentPosition() | Returns the current position of the device | 
| watchPosition() | Returns a watch ID value that then can be used to unregister the handler by passing it to the Geolocation.clearWatch() method |