Notifications
Published
Notifications let an installed PWA reach users after they leave the app. A server pushes a message, the service worker wakes to handle it, and a system notification appears. Request permission in context and in response to a user gesture. On iOS, the PWA must first be installed to the Home Screen.
In this section
Section titled “In this section”Web Push and PushManager.subscribe()How PushManager.subscribe() creates a VAPID-keyed PushSubscription, what endpoint, p256dh, and auth are for, and how push events reach the service worker.
Periodic background sync for content updatesWhen periodic background sync is the right tool for refreshing content, how Chrome gates it on installation and engagement, and how to test it.
Web Push on iOS and iPadOS (16.4+)Web Push for Home Screen web apps on iOS 16.4: the install requirement, the missing Notification interface in a tab, APNs delivery, and Declarative Web Push.
Notification actions and badge optionsThe actions and badge options of showNotification(): their fields, the two-button limit behind Notification.maxActions, the 96 by 96 badge, and engine support.
Notification triggers (showTrigger)What Chrome's Notification Triggers proposal added to showNotification() behind a flag, the showTrigger option and TimestampTrigger, and why it ended.
Notification interfaceThe Notification() constructor and its object: instance properties, the click, close, and error events, and why mobile browsers throw on the constructor.
Notifications APIShowing system notifications with showNotification() and getNotifications(), the persistent versus non-persistent split, and the TypeError paths.
Notification.requestPermission()How Notification.requestPermission() and Notification.permission work, the user-gesture rule Firefox 72 and Safari enforce, and Firefox's console messages.
Push subscription expiry and refreshWhat a subscription expiration time means, what pushsubscriptionchange carries on a refresh or a loss, and the Firefox versions that omit its two members.
Declarative Web PushDeclarative Web Push JSON, window.pushManager subscriptions, Safari support, service worker fallback, feature detection, and parser failures.
← Back to the Reference overview.