HTML5 Geo-Location (Latitude, Lognitutde)

<!DOCTYPE html>
<html>
<body>

<p>Click the button to get your coordinates.</p>

<button onclick="getLocation()">Try It</button>

<p id="demo"></p>

<script>
var x = document.getElementById("demo");

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>

</body>
</html>
Previous
Next Post »

1 comments:

Click here for comments
Prasad Aher
admin
6 June 2020 at 06:11 ×

nice post
for tech info visit this link : https://bit.ly/2AFihyF

Congrats bro Prasad Aher you got PERTAMAX...! hehehehe...
Reply
avatar