RESOLVED DUPLICATE of bug 293089 258726
navigator.permissions.query for geolocation reporting wrong value
https://bugs.webkit.org/show_bug.cgi?id=258726
Summary navigator.permissions.query for geolocation reporting wrong value
Alexander Berner
Reported 2023-06-30 06:35:07 PDT
After denying the geolocation after calling navigator.geolocation.getCurrentPosition navigator.permissions.query({name: "geolocation"}) still reports "prompt" instead of denied. Expected result would be "denied"
Attachments
Alexey Proskuryakov
Comment 1 2023-06-30 23:06:24 PDT
I think this may intentional, but CC'ing people who will know for certain.
Radar WebKit Bug Importer
Comment 2 2023-07-07 06:36:15 PDT
Alexander Berner
Comment 3 2023-07-16 12:53:21 PDT
Any news if this is behavior is intentional?
Marcos Caceres
Comment 4 2023-11-19 19:03:40 PST
Sorry for the delay. I'm not sure if this is intentional. It should be intentional on initial load of a document, so to not reveal a user preference. However, after an explicit denial from the user, it should probably return "denied".
Luca Passariello
Comment 5 2024-05-19 04:14:38 PDT
Hi, sorry to stick my nose in, but this is also the case for the opposite scenario. In the current version of Safari (on iOS 17.4.1) when requesting permission and accepting, the status never updates to granted. Even though you do not need to prompt again for the location. It will update to granted if the user has their global setting as 'allow' instead of 'ask'.
rupin
Comment 6 2025-06-06 19:37:50 PDT
Fixed in https://bugs.webkit.org/show_bug.cgi?id=293089! *** This bug has been marked as a duplicate of bug 293089 ***
rupin
Comment 7 2025-06-06 19:41:47 PDT
This is fixed in both cases now: 1. If the Geolocation API hasn't been used (so we haven't called "getCurrentLocation" or another one of it's functions), the Permissions API will return PROMPT. 2. If the Geolocation API has been used *within this page load*, the Permissions API will return GRANTED or DENIED depending on the user's response to the prompt. 3. If the page gets reloaded, this resets, so the Permissions API will once again return PROMPT. You can see the full table of behavior and its explanation in this PR: https://github.com/WebKit/WebKit/pull/45470. Thank you for reporting the bug and I hope this helps!
Note You need to log in before you can comment on or make changes to this bug.