Sololearn: Learn to Code
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1
<!DOCTYPE html> <body> <p id="position" onload="getLocation()">position</p> </body> </html> <script> var x = document.getElementById("position"); function getLocation() { if (navigator.geolocation) { navigator.geolocation.getCurrentPosition(showPosition); } else { x.innerHTML = "Geolocation is not supported by this browser."; } } function showPosition(position) { x.innerHTML = "Latitude: " + position.coords.latitude + "<br>Longitude: " + position.coords.longitude; } </script>
28th Oct 2016, 7:04 PM
seamiki
seamiki - avatar