@@ -2161,17 +2161,17 @@ HTML5's Geolocation API empowers web applications to access a user's geographica
21612161
21622162<script >
21632163function getLocation () {
2164- if (navigator .geolocation ) {
2165- navigator .geolocation .getCurrentPosition (showPosition);
2166- } else {
2167- document .getElementById (" demo" ).innerHTML = " Geolocation is not supported by this browser." ;
2168- }
2164+ if (navigator .geolocation ) {
2165+ navigator .geolocation .getCurrentPosition (showPosition);
2166+ } else {
2167+ document .getElementById (" demo" ).innerHTML = " Geolocation is not supported by this browser." ;
2168+ }
21692169}
21702170
21712171function showPosition (position ) {
2172- const latitude = position .coords .latitude ;
2173- const longitude = position .coords .longitude ;
2174- document .getElementById (" demo" ).innerHTML = " Latitude: " + latitude + " <br>Longitude: " + longitude;
2172+ const latitude = position .coords .latitude ;
2173+ const longitude = position .coords .longitude ;
2174+ document .getElementById (" demo" ).innerHTML = " Latitude: " + latitude + " <br>Longitude: " + longitude;
21752175}
21762176 </script >
21772177```
@@ -2180,7 +2180,7 @@ function showPosition(position) {
21802180
21812181[ ^ 47 ] CodeSandbox: Geolocation.
21822182
2183- [ ^ 47 ] :[ CodeSandbox: Geolocation] ( https://jkgprf.csb.app/ ) , last access: June 4, 2024 .
2183+ [ ^ 47 ] :[ CodeSandbox: Geolocation] ( https://jkgprf.csb.app/ ) , last access: January 28, 2025 .
21842184
21852185- The Geolocation API is accessed through JavaScript, typically initiated by user action.
21862186- The ` navigator.geolocation ` object provides methods for obtaining the user's location.
0 commit comments