crop_rotate
Run
<!DOCTYPE html> <html> <body> <h2>JavaScript Gelocation</h2> <p>Click the button to get your coordinates.</p> <button onclick="getLocation()">Try It</button> <p id="demo"></p> <script> const myElement = document.getElementById("demo"); function getLocation() { if (navigator.geolocation) { navigator.geolocation.getCurrentPosition(showPosition); } else { myElement.innerHTML = "Geolocation is not supported by this browser."; } } function showPosition(position) { myElement.innerHTML = "Latitude: " + position.coords.latitude + "<br>Longitude: " + position.coords.longitude; } </script> </body> </html>
JavaScript Gelocation
Click the button to get your coordinates.
Try It