I have written a JavaScript to get user geolocation. It gives me latitude and longitude and according to that I have plot user location in map, but when I check that location latitude and longitude in Google map it's different so that it plot me wrong place.
function map()
{
if (navigator.geolocation) {
browserSupportFlag = true;
navigator.geolocation.getCurrentPosition(function (position) {
initialize(position.coords.latitude,position.coords.longitude);
}, function () {
handleNoGeolocation(browserSupportFlag);
});
} else {
browserSupportFlag = false;
handleNoGeolocation(browserSupportFlag);
}
Please let me know how I can get accurate latitude and longitude by using navigator.geolocation
.