I am getting baffled with a problem that is, I can get the location of a user from Facebook and all I need is to get the latitude and longitude of that location, but I still cou
if (navigator.geolocation) { navigator.geolocation.getCurrentPosition(successFunction, errorFunction); } else { alert('It seems like Geolocation, which is required for this page, is not enabled in your browser. Please use a browser which supports it.'); }
If the browser supports geolocation and if getCurrentPosition
runs successfully, then a success function is called. And then in the function successFunction
have
function successFunction(position) {
var lat = position.coords.latitude;
var long = position.coords.longitude;
console.log('Your latitude is :'+lat+' and longitude is '+long);
}
Read more on the Geolocation API here