-
Location Watch
about 9 years ago
-
almost 9 years ago
You can use watchPosition of geolocation API of HTML5. Which continuously watches the users location.
<script> var x = document.getElementById("demoDiv"); if (navigator.geolocation) { navigator.geolocation.watchPosition(showPosition); } else { x.innerHTML = "Geolocation is not supported by this browser."; } function showPosition(position) { x.innerHTML = "Latitude: " + position.coords.latitude + "
Longitude: " + position.coords.longitude; } </script>Find more info here
-
-
about 9 years ago
Are you talking about geolocation?
The geolocation API allows the user to provide their location to web applications. You can get user lat & long and update it via background call (AJAX).
Reference: https://developer.mozilla.org/en-US/docs/Web/API/Geolocation/Using_geolocation
-
2 Answer(s)