Fix Firebase push notification not working on Safari on iOS

Try this snippet to fix your firebase push notification error on Safari on iOS/Mac OS. This will prevent blank page on your react.js app.

As Push API doesn’t support on Safari, so your firebase push notification (FCM) config will fail and will return an error or blank page especially on React.js app.

To fix that we can check if notifications are supported or not and if not then we will try to fake messaging object.

Check the below snippet and change your code accordingly.

Shyam has written 29 articles

Shyam is senior full stack developer, who loves to explore new technologies and work on them. He's passionate about coding so can code 24/7. He uses PHP as a backend programming language.

He knows Laravel, MySQL, AngularJS, ReactJS, Redis, Kubernetes, Git, CodeIgniter, PHP, MVC pattern, Lodash, jQuery, VanilaJS, Teamcity and many other technologies and tools.

Shyam writes notes and hacks on his blog (https://shyammakwana.me). In spare time he can be found @ StackOverflow or crafting any new open source application.

Passionate Programmer and Meditator #PERIOD.