I wrote a web page that uses javascript to read the user's location including latitude and longitude and finally post that location to a handler in server (to a RazorPage in asp.net core App).
function getMyLatitude() {
myLat = 0;
if (navigator.geolocation) {
navigator.geolocation.getCurrentPosition(function (position) {
myLat = position.coords.latitude;
})
}
return myLat;
}
This function works correctly.
But some browsers in their desktop version, such as Chrome, have an option by which the user can enter their desired position and from now on, the browser will return the same position as desired by the user.
chrome : developer tools -> settings -> location
Is there a way I can make it so that the user can't manually set their location in the browser, or should I read the user's actual location?