Geolokalizacja API
Obiekt geolokalizacji
Obiekt Geolokalizacja pozwala użytkownikowi na podanie swojej lokalizacji aplikacjom internetowym. Ze względu na ochronę prywatności użytkownik jest proszony o zgodę na zgłaszanie informacji o lokalizacji.
Uwaga: ta funkcja jest dostępna tylko w bezpiecznych kontekstach (HTTPS).
Uwaga: Geolokalizacja jest najdokładniejsza dla urządzeń z GPS, takich jak iPhone.
Geolokalizacja API jest publikowana za pośrednictwem obiektu navigator.geolocation .
Właściwości obiektu geolokalizacji
Property | 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() |
Metody obiektów geolokalizacyjnych
Method | Description |
---|---|
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 |