Adam Khoury

Donate funds to show love and support

Click the button below to donate funds securely online. You can use your PayPal account or a credit card.

Your donations help free up my time to produce more content and assist in covering server costs. It's also a great way to say thanks for the content!

Application Configuration

Adam will be adding options here soon.

Real Time GPS User Tracking Geolocation API JavaScript Programming

Published :
Author :
Adam Khoury

Track location, speed, heading and altitude in real-time or as a one shot request for a user. Add the pieces of data to your database, then recall the data when needed to show their position markers on a map of your choosing.

<div id="details"></div> <script> // map.innerHTML = '<iframe width="700" height="300" src="https://maps.google.com/maps?q='+latitude+','+longitude+'&amp;z=15&amp;output=embed"></iframe>'; var reqcount = 0; navigator.geolocation.watchPosition(successCallback, errorCallback, options); function successCallback(position) { const { accuracy, latitude, longitude, altitude, heading, speed } = position.coords; // Show a map centered at latitude / longitude. reqcount++; details.innerHTML = "Accuracy: "+accuracy+"<br>"; details.innerHTML += "Latitude: "+latitude+" | Longitude: "+longitude+"<br>"; details.innerHTML += "Altitude: "+altitude+"<br>"; details.innerHTML += "Heading: "+heading+"<br>"; details.innerHTML += "Speed: "+speed+"<br>"; details.innerHTML += "reqcount: "+reqcount; } function errorCallback(error) { } var options = { //enableHighAccuracy: false, //timeout: 5000, //maximumAge: 0 }; </script>