The Geolocation API
Learn how to get the location of users with the web Geolocation API.
We'll cover the following...
Overview
The Geolocation API allows webpages to detect the physical location of the user’s device. However, we must prompt the user for permission before accessing their location. The browser will show a permission dialogue, which users can allow or block.
With the user’s permission, a webpage can get the user’s location, display it on a map, or use it in other ways. This is useful for showing nearby points of interest, location-based searches, or tracking a user’s current location.
How it works
The Geolocation API works by detecting the IP address of the user’s device or using GPS/location services on mobile devices or Wi-Fi access points. The browser ...