Push notifications were long a reason to build a native app. Today progressive web apps can send notifications too: on Android and desktop for years, and on iOS since version 16.4 for web apps installed on the home screen.
How it works
The web app asks for permission and registers with the browser’s push service. The server sends messages to this service, signed with a VAPID key pair. On the device, the service worker receives the message and displays the notification, even when the app is closed.
Permission and good practice
Permission should only be requested after a user action, not on the first page view. It helps to explain beforehand what notifications will be used for. Sending too many or irrelevant messages quickly loses the permission again.
Data protection
Messages travel through browser vendors’ push services. Content should therefore be encrypted, as the standard provides, and contain no sensitive data in plain text. Marketing notifications need appropriate consent.
Limits
Web Push does not replace all native app capabilities, such as persistent background processes. Whether a PWA is enough is shown by our app form factor check.
