HTML Geolocation & Privacy
The Geolocation API allows the user to provide their location to web applications if they so desire. For privacy reasons, the user is asked for permission to report location information.
The Navigator Object
The API is published through the navigator.geolocation object. If the object exists, geolocation services are available. Always check for support before attempting to access it.
Methods: Get vs Watch
Use getCurrentPosition() for a one-time retrieval. Use watchPosition() to register a handler function that will be called automatically each time the position of the device changes.
Handling Errors
The second parameter of the methods is an error handling callback. It can handle cases like PERMISSION_DENIED or TIMEOUT.
View Full Transcript+
This section contains the full detailed transcript of the video lessons regarding Geolocation API. It covers the Navigator interface, Position interface, Coordinates, and security requirements (HTTPS).
