Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Push notifications on iOS from web-app

I'm developing a web-app and I want to send push notifications to users on iPhone. Is there any way of doing this from the browser? Chrome or Safari does not matter.

like image 414
antontitoff Avatar asked May 16 '17 07:05

antontitoff


People also ask

Can a web app do push notifications?

Chrome, Firefox, Opera and Safari currently support web push notifications. Supported browsers vary by vendor. Notifications vary in appearance between browsers and operating systems. Some notifications use native notification centers, others don't.

Can you get notifications from a website on iPhone?

Click on the Safari option and tap on Preferences. Tap on the Website icon, scroll down and click Notifications. Choose the site(s) you wish to receive push notifications and click Allow from the drop-down menu.

How do I send push notifications to iOS?

Go back to the iOS project you created earlier and select the main target. Under the Signing & Capabilities tab, click on the + Capability button, then select Push Notifications. This will enable your app to receive push notifications from OneSignal. Next, you'll need to add a Notification Extension to the app.


1 Answers

As of today a web app cannot receive push notifications on any iOS browser (Safari, Chrome for iOS, ...). The reason is that iOS does not yet include an implementation of Service Workers, which are needed for push notifications to work. It is currently in development, though: https://webkit.org/status/#specification-service-workers

And it is already working on Safari for OS X: https://developer.apple.com/notifications/safari-push-notifications/

Meanwhile, you will have to settle for a native implementation of your app, at least on iOS. My recommendation would be using what you have developed for web and making it a hybrid app through the use of Apache Cordova.

You can also regularly check if support is available here:

  • https://jakearchibald.github.io/isserviceworkerready/
  • https://caniuse.com/#feat=serviceworkers
  • https://caniuse.com/#feat=push-api
like image 96
jaime.ferbec Avatar answered Oct 18 '22 03:10

jaime.ferbec