Search code examples
javascriptioshtmlsafarimobile-safari

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


Solution

  • 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.