I have implemented the HTML Geolocation feature on my project, however I have noticed its not always reliable.
How can I add a fallback to timeout after x seconds and display an error?
Here is my code:
function getLocation()
{
if (navigator.geolocation)
{
navigator.geolocation.getCurrentPosition(showPosition);
}
else{x.innerHTML = "Geolocation is not supported by this browser, please manually enter your postcode above";}
);
}
function showPosition(position)
{
x.innerHTML = "Latitude: " + position.coords.latitude +
"<br>Longitude: " + position.coords.longitude;
}