Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Safari iOS Geolocation API popup showed multiple times

I've written a code that use HTML5 Geolocation API to get user position.

The code is written for mobile website.

The code works fine, but every times that page is reloaded Safari (iOS) asks the user, through the system popup, if she wants to share her current position or not.

I want to know if there's the possibility not to ask for the user's confirmation every time, as the user has already given permission to use her position.

Here's my code:

 if (navigator.geolocation){
     navigator.geolocation.getCurrentPosition(st.onSuccess,st.onError);
 }else{
     st.onNotSupportedBrowser();
 }

These methods(st.onSuccess, st.onError, st.onNotSupportedBrowser) are the callbacks that I use when the events get triggered.

Thanks

like image 768
JBerta93 Avatar asked Nov 30 '25 20:11

JBerta93


1 Answers

I confirm that isn't possible to limit the opening of geolocation authorization system popup because it is managed by Safari's core and it performs the API in this way. There're no bugs in the upper code, because I use the native HTML5 API.

Hope that this helps you.

like image 74
JBerta93 Avatar answered Dec 02 '25 09:12

JBerta93



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!