Geolocation API allows you to access the user's location information, with their permission, using JavaScript. You can use this information to display location-based content or to create location-aware web applications.
Get Location
<script> function getLocation() { if (navigator.geolocation) { navigator.geolocation.getCurrentPosition(showPosition); } else { alert("Geolocation is not supported by this browser."); } } function showPosition(position) { alert(`Latitude: ${position.coords.latitude}, Longitude: ${position.coords.longitude}`); } </script>