Request location coordinates after user has blocked access in javascript

How can I prompt a user for their geo-location in javascript if they've blocked my request in the past? (using navigator.geolocation.getCurrentPosition).

For example, my web app requires location services, and the user accidentally clicks "block", or they change their mind. What can I do to prompt them again?



As mentioned by @matthew-shwery, you can not change the permission.
the best you could do is check for the permission and notify the user is the permission is denied

     name: 'geolocation'
 }).then(function(result) {
     if (result.state == 'granted') {
         report(result.state); = 'none';
     } else if (result.state == 'prompt') {
         report(result.state); = 'none';

         navigator.geolocation.getCurrentPosition(revealPosition, positionDenied, geoSettings);
     } else if (result.state == 'denied') {
         report(result.state); = 'inline';
     result.onchange = function() {

Geolocation docs


You can't.

The user must manage their browser settings manually because your site is added to a blacklist when denied location permissions.

Here are instructions for Chrome users to manage their location permissions:


Recent Questions

Top Questions

Home Tags Terms of Service Privacy Policy DMCA Contact Us

©2020 All rights reserved.