Is there any function in geolocation api like isGeolocationAllowed or isGeolocationAllowedForever?

78 views Asked by At

Is there a way to check from javascript if user already allowed geolocation in current page for once or forever? Maybe browsers stores somewhere we can read it from i don't know. Also is there any function that listens the allow or deny buttons instantly except the result of geolocation request? I have checked the docs but i couldn't find anything that helps.

Thank you.

1

There are 1 answers

0
Radek Pech On BEST ANSWER

No, there is no way to check if geolocation is allowed or not. The only thing you can do is ask for location and wait for either success or fail. (In Firefox you can't even detect the deny for now state, only for allow and deny for ever).

Look on code of this demo for more details on what can be done:

http://demo.chobits.ch/js/geolocation/