Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Geolocation API Permissions Web Browser

I'm using this code to get the user geoposition. All goes well until the user deny permission to get the location. It seems this option gets cached and I don't know how reset it.

Is there any way to re-ask permission? Thanks in advance!

if (navigator.geolocation) {                                            

        navigator.geolocation.getCurrentPosition(function(position) {       

            // Success Callback


        }, function(error) {
            //error Callback

        },{
                  //options
            });
     }else{
        //geolocation not available
     }
like image 899
Nicolas Monjelat Avatar asked Jun 02 '11 14:06

Nicolas Monjelat


People also ask

How do you get geolocation without permission?

You can go for an external service like https://www.geolocation-db.com. They provide a geolocation service based on IP addresses where you don't need user permission.

Which API in html5 allows you to identify the location of the user?

The HTML Geolocation API is used to locate a user's position.

What are uses of geolocation in web page?

The Geolocation API lets you discover, with the user's consent, the user's location. You can use this functionality for things like guiding a user to their destination and geo-tagging user-created content; for example, marking where a photo was taken.


1 Answers

Pretty sure this is a browser/device setting stored per site. I think the point is that you can't reset this from a script as it would defeat the point of the prompt in the first place. I believe the only way to reset is to change the setting in the browser/device.

like image 50
bgreater Avatar answered Oct 30 '22 22:10

bgreater