π· About HTML Geolocation API - 1
A Thread𧡠π
π HTML Geolocation API
β The HTML Geolocation API is used to locate a user's position.
β¦οΈ Locate the user's position
β The HTML Geolocation API is used to get the geographical position of a user.
β Since this can compromise privacy, the position is not available unless the user approves it.
β Note:-Geolocation is most accurate for devices with GPS, like smartphones.
π Using HTML Geolocation
β The getCurrentPosition() method is used to return the user's position.
β The example below returns the latitude and longitude of the user's position.
β Example explained:-
β Check if Geolocation is supported If supported, run the getCurrentPosition() method.
β If not, display a message to the user.
β If the getCurrentPosition() method is successful, it returns a coordinates object to the function specified in the parameter (showPosition).
β The showPosition() function outputs the Latitude and Longitude
β The example above is a very basic.
β Geolocation script, with no error handling.
Thanks for reading this thread β€οΈ
If you like it , make sure you:
π· Like the tweet
π· Retweet the first tweet β‘
For more content , follow:
@MrunayU