π· About HTML Geolocation API - 2
A Threadπ§΅ π
π Handling Errors and Rejections
β The second parameter of the getCurrentPosition() method is used to handle errors.
It specifies a function to run if it fails to get the user's location.
π Location-specific Information
β This has demonstrated how to show a user's position on a map.
β Geolocation is also very useful for location-specific information, like:
β’ Up-to-date local information
β’ Showing Points-of-interest near the user
β’ Turn-by-turn navigation (GPS)
π The getCurrentPosition() Method- Return Data
β The getCurrentPosition() method returns an object on success.
β The latitude, longitude and accuracy properties are always returned. The other properties are returned if available.
π Geolocation Object Other interesting Methods
β The Geolocation object also has other interesting methods:
β’ watchPosition() - Returns the current position of the user and continues to return updated position as the user moves (like the GPS in a car).
β’ clearWatch() - Stops the watchPosition() method.
β The example below shows the watchPosition() method.
β You need an accurate GPS device to test this (like smartphone).
Thanks for reading this thread β€οΈ
If you like it , make sure you:
π· Like the tweet
π· Retweet the first tweet β‘
For more content , follow:
@MrunayU