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
}
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.
The HTML Geolocation API is used to locate a user's position.
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.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With