Geolocation API
Die Geolocation Object
Die Geolocation-objek laat die gebruiker toe om hul ligging aan webtoepassings te verskaf. Om privaatheidsredes word die gebruiker toestemming gevra om ligginginligting aan te meld.
Let wel: Hierdie kenmerk is slegs beskikbaar in veilige kontekste (HTTPS).
Let wel: Geografiese ligging is die akkuraatste vir toestelle met GPS, soos iPhone.
Die geolocation-API word deur die navigator.geolocation- objek gepubliseer.
Geolocation Object Properties
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() |
Geolocation Object Metodes
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 |