Geolocatie-API
Het geolocatie-object
Met het object Geolocation kan de gebruiker zijn locatie doorgeven aan webapplicaties. Om privacyredenen wordt de gebruiker om toestemming gevraagd voor het melden van locatiegegevens.
Opmerking: deze functie is alleen beschikbaar in beveiligde contexten (HTTPS).
Opmerking: Geolocatie is het meest nauwkeurig voor apparaten met GPS, zoals iPhone.
De Geolocation API wordt gepubliceerd via het navigator.geolocation object.
Eigenschappen van geolocatie-object
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() |
Methoden voor geolocatie-objecten
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 |