Search code examples
javascripthtmlgeolocation

Test if html5 geolocation permission already has been granted


Does anyone know if there is a way to test if prior html5 geolocation permission has been granted?

I try to make a script that does not request the geolocation unless the permission for the page has already been given. Does not nessicerily have to be html5; other frameworks are also ok.


Solution

  • According to the Geolocation API Specification there isn't any function for this. Even the option to save it in the browser preferences isn't pushed to your code.

    If it's realy important and you realy have to beeing aware of this, you have to write a browser addon for every common browser and ask the user to install it. But i wouldn't doubt of it.