Bug 247315
| Summary: | `'Notification' in window` returns false | ||
|---|---|---|---|
| Product: | WebKit | Reporter: | N <hendrex.jakai> |
| Component: | DOM | Assignee: | Nobody <webkit-unassigned> |
| Status: | RESOLVED WONTFIX | ||
| Severity: | Normal | CC: | ap, ashvayka, bedney, beidson, cdumez, rniwa, webkit-bug-importer |
| Priority: | P2 | Keywords: | InRadar |
| Version: | Safari 16 | ||
| Hardware: | iPhone / iPad | ||
| OS: | iOS 16 | ||
| See Also: | https://bugs.webkit.org/show_bug.cgi?id=264074 | ||
N
Hey
I have iOS 16.2 installed on my iPhone, and I have enabled under Safari's experimental WebKit features:
- Built-in Web Notifications
- Push API
- Permissions API
However, while `'PushManager' in window` returns true, `'Notification' in window` returns false, so I can't use the very basic `Notification.permission` so I can handle the modals and requests properly.
Do you know if it will be the case that Safari won't be supporting such basic and important thing as `Notification.permission` ?
Thank you!
| Attachments | ||
|---|---|---|
| Add attachment proposed patch, testcase, etc. |
Alexey Proskuryakov
Notification.permission is certainly supported, and exposed as window.Notification.permission. CC'ing some folks who would know why the "in window" check fails.
N
Thanks Alexey.
I've just tested "window.Notification", and it seems to be "undefined".
I double checked, and I have those same 3 feature flags (listed in my previous comment) enabled.
Brady Eidson
No matter what you've done with those experimental feature flags, window.Notification is not supported in Safari on iOS 16.
As for your questions of when Safari will support a particular feature; Safari is a product shipped by Apple, not the WebKit open source project.
So this is not a place where that can be answered.
Alexey Proskuryakov
I tested wrong. First, I tested on macOS. Second, I tried `Notification in window` instead of `'Notification' in window`. Embarrassing.
N
Thanks Brady.
Could you please indicate where can I report this and get answers about this?
This looks like a significant hole on the implementation of Web Push, as we need to know the value of `Notification.permission` to be able to optimize the user's experience on the website.
(and avoid annoying the user, or provide the user with instructions to unblock the notifications if they are trying to turn these on again, etc)
Radar WebKit Bug Importer
<rdar://problem/102087326>
Brady Eidson
(In reply to N from comment #5)
> Thanks Brady.
>
> Could you please indicate where can I report this and get answers about this?
>
> This looks like a significant hole on the implementation of Web Push, as we
> need to know the value of `Notification.permission` to be able to optimize
> the user's experience on the website.
>
> (and avoid annoying the user, or provide the user with instructions to
> unblock the notifications if they are trying to turn these on again, etc)
Can you use navigator.permissions for that?
There's a code snippet here:
https://webkit.org/blog/14112/badging-for-home-screen-web-apps/
William J. Edney
In case anyone else happens upon this bug, in Safari for iOS (at least as of iOS 17.3), the Notification object is undefined (i.e. "'Notification' in window" will fail) *unless the page is "installed"* (i.e. it is running as a PWA / has been "Add(ed) To Home Screen").