I use Firebase's cloud messaging, but it won't work on iPad and iPhone. It's the simplest usage i can do with it. I just did all the tutorial about offsite notifications but i got this error directly in the Firebase's script.
iOS does not support the Notification API https://caniuse.com/#search=Notification
I created a function that lets you know if the user's browser supports it.
const isSupported = () =>
'Notification' in window &&
'serviceWorker' in navigator &&
'PushManager' in window
And the use it before using the Notification API
eg:
if (isSupported()) {
const hasPermission = Notification.permission === 'granted'}
The firebase JavaScript library you're using is incompatible with Safari on iOS. The Safari browser that runs on iOS devices is not the same as the desktop build of the application and does not have the same feature set.
In this specific case, iOS Safari is throwing an error on your firebase.js library attempting to use the Web Notification APIs requestPermission() method in order to allow firebase to show notifications to the user. The Notification API doesn't exist though.
You can see the support for the Notification API here: http://caniuse.com/#search=Notification
You may have to look at an alternative or disable the firebase library when your web app is viewed on mobile devices which don't support it. If it's supposed to work on iOS Safari then you should file a bug with Firebase and see if there's a patch or update available which resolves the issue in the firebase.js library.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With