-
Notifications
You must be signed in to change notification settings - Fork 22.5k
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
Permissions API - update to docs needed #13003
Comments
@hamishwillee, happy to review things! Just ping 🛎. |
Fixed via #22439; this should be closed. |
Oh, sorry I totally missed this 😢 . I’ll still have a look. |
@marcoscaceres hiya mate; hope you like it ;-) |
@chrisdavidmills AFAIU, this issue is talking about the permissions web API, which I don't see #22439 touching; do you think it is still adequately addressed since I can't tell? |
@Josh-Cena No, this has not been updated. The fact that @chrisdavidmills confused permissions API and permissions policy is precisely the point :-). I'd love to tackle this, just that it's a significant amount of work. |
I didn't exactly confuse it, and I did add the following section to try to straighten this out a bit: https://developer.mozilla.org/en-US/docs/Web/HTTP/Permissions_Policy#relationship_with_the_permissions_api But looking at this again, the Permissions API docs need work too, so this should stay open after all. |
THanks @chrisdavidmills - ah, knew I'd seen that. Handy, we can include/cross link that info in the permission API too. |
@marcoscaceres Just doing a little prep work for this. I was wondering if I could get some confirmations (no urgency, I'm about to go on holiday for a couple of weeks):
|
The #23680 makes use of a pattern we can use for documenting and linking the permission api permissions. Essentially it is a security section that exists in the api overview and the api page where access is requested. This will include all permission info. |
Hi @hamishwillee! Welcome back! I'm also just coming back from vacation.
Correct. They are deprecated, non-standard, and there is no plan to bring those back.
Correct. But, it's also extremely useful to know if the API will "prompt" (and if so, to possibly show UI). So good for both showing and hiding.
Correct. The user does revokes permission through the browser's UI (or maybe even through the OS, as is the case in macOs or iOS). There is no API to revoke permissions.
Correct. We've been a bit slow in updating the registry. Sorry about that! Nevertheless, the compat table does seem to accurately reflect the state of some permissions still being experimental, which is great.
The short answer is: no. things like things like The long version: As you described above, the sole purpose of the Permission API allows you to So, every APIs must provide their own permission request mechanism. For example: // Check state of geolocation
const status = await navigator.permissions.query({name: "geolocation"})
if (status.state === "prompt") {
try {
// getCurrentPosition() and watchPosition() will prompt for permission
const pos = await new Promise((res, res) => navigator.geolocation.getCurrentPosition(res, rej);
} catch (positionError){
// check if user denied permission...
}
}
// and so on... |
The Permission API is associated with UI features that require explicit permission from the user to access (or some equivalent proxy for permission). For example, geolocation potentially exposes very sensitive user information and hence requires explicit user permission to use. It is used by developers to determine whether permission has been granted to use the associated API.
There are a number of things to fix in the current MDN docs. The main one is that it is too easy to confuse with the Permissions API (related to user granted permissions) with the Permission Policy which provides server granted permissions to use similar features. Both APIs are similarly named and use similar/same strings to define the features.
The permissions API permissions are now defined in each spec, but registered in a powerful feature registry: https://w3c.github.io/powerful-features-registry/ we should explain that.
Other things:
@marcoscaceres Love your work in w3c/permissions#263 . Would appreciate it if you are able to keep an eye on the MDN fixes. Not sure who will do them. Possibly me, once I finish my queue :-)
The text was updated successfully, but these errors were encountered: