-
Notifications
You must be signed in to change notification settings - Fork 12
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
Notification permission requirement #110
Comments
I think if the user agent wants, they can show the required permission prompt when the app tries to set a badge, so websites shouldn't need to worry about requesting the permission separately. Was that what we intended here @marcoscaceres? Sounds like it might be worth cleaning up anyway |
For an API like this (which might be called in contexts where permission prompts can't be shown like service workers, or without user interaction) generally the user agent automatically showing a permission prompt doesn't work very well. Although it is one thing I am considering maybe doing. It would at least be better than user agent sniffing or unconditionally requesting permission... |
This is what the demo does now unfortunately. |
Good point @mkruisselbrink - I've clearly been out of it for a while 😆 Hmm, definitely feels unideal that the demo is unconditionally requesting permission to show notifications - Is it a requirement now, that the notifications permission is granted? |
It's a requirement in Safari, and it might become a requirement in Chrome on MacOS (for the same OS reasons that it is a requirement in Safari I imagine). |
In step 4.2 of the setting the application badge algorithm, it is written that if a user agent requires express permission (and notifications permission hasn't been granted), they should jected with a NotAllowedError. As far as I know this isn't implemented by at least the one user agent I'm aware of that has this permission requirement (i.e. webkit), as both Navigator.setAppBadge and the equivelent WorkerNavigator code unconditionally resolve the returned promise with undefined.
But without that promise rejection, I'm not sure how websites are supposed to determine if they are required to request notifications permission in order to use app badging. Are we expecting site authors to do user agent sniffing (and try to come up with a complete list of user agents that have this requirement)?
Should there perhaps be a separate "is notifications permission required for app badging" API?
And if there are no user agents that actually implement step 4.2, should the step even exist in the algorithm?
The text was updated successfully, but these errors were encountered: