HTML Editor
<!DOCTYPE html> <html lang="en-US"> <body> <p>Html Geolocation will help you finding your users Location.</p> <button onclick="getMyLocation()">Click To Your Location</button> <p id="point"></p> <script> var x = document.getElementById("point"); function getMyLocation(){ 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> </body> </html>
OUTPUT
×

Save as Private