Hi Can we get GPS location using javascript without internet connection if device has GPS hardware?
Please note who are marking it as duplicate
I need javascript to work without internet connection and use GPS hardware to determine the location.
Javascript can show you geolocation via navigator.geolocation
.
function getLocation()
{
if (navigator.geolocation)
navigator.geolocation.getCurrentPosition(showPosition);
else
console.log("Geolocation is not supported by this browser");
}
function showPosition(position)
{
console.log("Latitude: " + position.coords.latitude);
console.log("Longitude: " + position.coords.longitude);
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With