I am building a website that asks permission to use a person's location using - navigator.geolocation.getCurrentPosition(positionFound)
.
Using javascript or jQuery, how can I detect if a user denies permission, the moment after they deny it?
My code looks something like this -
function Geolocation() {
navigator.geolocation.getCurrentPosition(positionFound)
}
function positionFound(position, found) {
if (position.coords) {
//do stuff
}
}
Part of the problem is, the code after navigator
is reached before the user accepts or denies permission to use the computer's location.