I want to obtain the latitude and the longitude from the navigator and then show them. My code is not working, it is not showing the alert:
lat = position.coords.latitude;
long = position.coords.longitude;
alert(long + " " + lat);
I think your code is fine. The issue will most likely be that you are trying to use the Geolocation API on an insecure connection. Make sure you are viewing your page on https.