How do i reset the geo-location service settings each time my page loads with HTML5 and Javascript

3k Views Asked by At

I am working on a web page where I need to get permission from a user to access location.

but according to my story. I need to make sure that if any particular user has selected Deny previously then on each page load I need to show him a prompt saying

[website] want to use your computer's location as shown in the snapshot below: enter image description here

But on the other hand, if the user has selected Allow it should not prompt anymore.

Is there any easy and straightforward way to achieve this functionality with JS or HTML5 settings? If not then what else I could do in order to achieve this functionality?

1

There are 1 best solutions below

0
On

This is not possible.

See: How to make Google Maps to request again for location permissions?

The browser handles this and once a choice has been made, you cannot reverse it. If your site requires geolocation to work, you can always check if the permission is given (see here: Is there a way to check if geolocation has been DECLINED with Javascript?) and if not, you should change the content or behaviour of the site, so your users know what's going on.