Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

After granting location permissions to the Geolocation API, it will request permissions again when you refresh the page. This phenomenon is occurring on iOS. #422

Closed
LeeSangUk2 opened this issue Oct 26, 2023 · 3 comments

Comments

@LeeSangUk2
Copy link

LeeSangUk2 commented Oct 26, 2023

If you refresh the page after initially granting location permissions, you will be prompted for location permissions again and will need to grant permission again. Currently this only occurs on iOS. Is there a way?

The tested iOS versions are 16.2 and 17.

This is the code implemented when retrieving location information.

<script>
        var options = {
            timeout: 15000,
            enableHighAccuracy: true,
            maximumAge: 86400000,
        };

        function success(pos) {
            var crd = pos.coords;

            alert('Your current position is:');
            alert(`Latitude : `+crd.latitude);
            alert(`Longitude: `+crd.longitude);
        };

        function error(err) {
            alert(`ERROR(): `+err.message);
        };
        navigator.geolocation.getCurrentPosition(success, error, options);
</script>
@tomayac
Copy link
Contributor

tomayac commented Oct 26, 2023

(Please note that this is not a support forum.) The geolocation permission on iOS is one-time by default. If you go to Settings and then Safari, you can toggle "Location Access On All Websites" between "Ask" (default), "Deny", and "Allow".

@LeeSangUk2
Copy link
Author

LeeSangUk2 commented Oct 26, 2023

I launched that web from app and the Safari settings didn't fix the issue. What should I do about this problem?

@miketaylr
Copy link
Member

It's probably better to ask a question like this on stackoverflow, or if you feel like there's a bug, try reporting it to Apple. Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants