Apple does not offer a way to handle a notification that arrives when your app is closed (i.e. when the user has fully quit the application or the OS had decided to kill it while it is in the background). If this happens, the only way to handle the notification is to wait until it is opened by the user.
iOS (Apple) mobile devices do not currently support mobile web push notifications, though Apple has announced support will be coming in 2023. This means even if an iPhone or iPad has a supported browser such as Chrome installed, users cannot receive web push notifications on the device.
This means the browser can have no windows open, and you'll still receive the push message in your service worker, because the browser in running in the background. The only time a push won't be received is when the browser is completely closed, i.e. not running at all (no marking).
Don't get confused here by the “mobile” because you can send web push notifications on mobile too (on Android). With web push notifications the notifications are sent from the browser, whether that's to a mobile or a desktop device. With mobile notifications, the notifications come from the app.
To be more specific, in order for a web application to send push notifications to a mobile device, such as the iPhone, the mobile device must have registered to receive push notifications for a particular application. The registration for push notification is done through a native app and can only be performed through a native app. Once the native app is registered for push notification, it can send the authorization token to the server, which can be used in conjunction with the certificate used to provision the native client, to send the push notifications to the mobile device.
As specified in another answer, one option is to 'wrap' your web application in a native application. Meaning that you would create a native application that basically presents a UIWebView (for iPhone dev) to the user showing your web application. While this pretty much functions in the same manner as the native browser, you would be able to add the ability to register for push notifications using the native controls.
It would be beneficial to you to review the Apple's push notification document as it provides some pretty good information on how push messaging functions on the iPhone.
See these links provided by Peter Hosey:
While not yet supported on iOS (as of iOS 10), websites can send push notifications to Firefox and Chrome (Desktop/Android) with the Push API.
The Push API is used in conjunction with the older Web Notifications to display the message. The advantage is that the Push API allow the notification to be delivered even when the user is not surfing your website, because they are built upon Service Workers (scripts that are registered by the browser and can be executed in background at a later time even after your user has left your website).
The process of sending a notification involves the following:
The Push API is currently supported on desktop and Android by Chrome, Firefox and Opera.
You can also send push notifications to Apple / Safari desktop using APNs. The approach is similar, but with many complications (apple developer certificates, push packages, low-level TCP connection to APNs).
If you want to implement the push notifications by yourself start with these tutorials:
If you are looking for a drop in solution I would suggest Pushpad, which is a service I have built.
Update (September 2017): Apple has started developing the service workers for WebKit (status). Since the service workers are a fundamental technology for web push, this is a big step forward.
No, only native iOS applications support push notifications.
UPDATE:
Mac OS X 10.9 & Safari 7 websites can now also send push notifications, but this still does not apply to iOS.
Read the Notification Programming Guide for Websites. Also check out WWDC 2013 Session 614.
You can use pushover if you don't want to create your own native app: https://pushover.net/
Google Chrome now supports the W3C standard for push notifications.
http://www.w3.org/TR/push-api/
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