Safari Notifications disabled under WebKit Feature Flag
I have been developing a few PWAs since Apple finally introduced Notifications via the Push API in iOS 16, and suddenly when implementing this to a new PWA, I didn't get any prompt. Turns out:
const status = await window.Notification.requestPermission();
// returns 'denied'
This happened to everyone at work, and even the customer. Everyone running newest version of iOS17.
I found out that under Settings > Safari > Advanced > Feature flags that Notifications was turned off, and that Push API no longer exists there.
This was turned off on all 8 devices I've checked with, and none of their owners didn't even know that this setting existed so they have not turned it off themselves.
Enabling this setting makes Notifications work in PWAs again.
Is this a bug, or is it intensional by Apple?
How can I get users of the web app to activate this option, when the only thing I get from requestPermission is denied?
If I run a check to see if Notifications is available in the browser whilst Notification Feature flag is turned off, I still get true:
(('serviceWorker' in navigator) && ('PushManager' in window) && ('Notification' in window))
So there's no good way of giving users feedback.
And, I can't find any evidence of this anywhere, so I need some answers 😀
iPhone 13 Pro Max