javascript - Make html5 geolocation ask permission every time user reloads the page -
why need that:
we have page in our website allows users enter data , search customers in area. when user opened page popup message must shown
http://foo.bar.com use current location.
after user can discard , fill location fields manually or accept , automatically redirected results page.
problem:
the problem when user selects of mentioned options @ first time, browser remembers , don't ask next time. when user accept it, every time open search page automatically redirect him results page withous asking anything.
code:
we using basic html5 geolocation code
if (navigator.geolocation) { navigator.geolocation.getcurrentposition(locationmethod); }
conclusion:
i'm pretty sure it's impossible change permission browser-native. hope give nice solution problem. thanks.
once user clicks deny/allow browser remembers decision site.
the best way avoid deny call getcurrentposition(...) when user clicked means wants use location. , glad share :)
a example on foursquare site. on entering offers go map city, , there clicking button on map of "use location" prompts it.
if denied location show info message "you have denied location service in past site, enable bla bla bla". , fill in bla bla bla whatever.
Comments
Post a Comment