navigator.geolocation
- navigator is object available in JS.- we can use this object to get geolocation
navigator.geolocation
if (navigator.geolocation) {
navigator.geolocation.getCurrentPosition(function(position) {
$("#data").html("latitude: " + position.coords.latitude + "<br>
longitude: " + position.coords.longitude);
});
}