Web Push Notifications
Web push notifications are messages that a website can send to a user's device even when the browser or site isn't open, delivered via the browser's Push API and typically handled by a service worker in the background.
Definition
Web push notifications are messages that a website can send to a user's device even when the browser or site isn't open, delivered via the browser's Push API and typically handled by a service worker in the background.
Overview
Web push notifications let a site re-engage users outside the browser tab, similar to native mobile app notifications. A user first grants permission through the browser, which generates a unique subscription (an endpoint URL and encryption keys) that the site's backend stores and later uses to send messages through the browser vendor's push service. A Service Worker running in the background receives the push event and is responsible for displaying the notification, even if the site isn't currently open in a tab. The flow relies on two browser APIs working together: the Push API, which handles receiving messages from a server while the page isn't active, and the Notifications API, which controls how the notification actually appears on screen (title, icon, actions). Because push messages are relayed through a browser vendor's infrastructure, payloads are encrypted end-to-end between the sending server and the browser so the push service itself can't read the content. Web push is one of several ways browsers let sites communicate with users asynchronously, alongside more server-oriented techniques like Webhooks for server-to-server notifications. Support and reliability vary by platform — notably, historical gaps in iOS Safari support meant web push adoption lagged behind native apps for years, though modern versions of Safari have added support. It's commonly used in Progressive Web Apps to approximate native app engagement without requiring an app store install, and pairs naturally with client-side storage such as IndexedDB to queue and display notification history offline.
Key Concepts
- Delivers notifications even when the site or browser tab isn't open
- Requires explicit user permission before a subscription can be created
- Relies on a service worker running in the background to receive and display messages
- Uses the browser's Push API for delivery and Notifications API for display
- Payloads are encrypted between the sending server and the browser
- Delivered through the browser vendor's own push infrastructure
- Commonly used to boost engagement in Progressive Web Apps