PushManager

Baseline Widely available *

This feature is well established and works across many devices and browser versions. It’s been available across browsers since March 2023.

* Some parts of this feature may have varying levels of support.

Secure context: This feature is available only in secure contexts (HTTPS), in some or all supporting browsers.

Note: This feature is available in Web Workers.

The PushManager interface of the Push API provides a way to receive notifications from third-party servers as well as request URLs for push notifications.

This interface is accessed via the ServiceWorkerRegistration.pushManager property.

Static properties

PushManager.supportedContentEncodings

Returns an array of supported content codings that can be used to encrypt the payload of a push message.

Instance methods

PushManager.getSubscription()

Retrieves an existing push subscription. It returns a Promise that resolves to a PushSubscription object containing details of an existing subscription. If no existing subscription exists, this resolves to a null value.

PushManager.permissionState()

Returns a Promise that resolves to the permission state of the current PushManager, which will be one of 'granted', 'denied', or 'prompt'.

PushManager.subscribe()

Subscribes to a push service. It returns a Promise that resolves to a PushSubscription object containing details of a push subscription. A new push subscription is created if the current service worker does not have an existing subscription.

Deprecated methods

PushManager.hasPermission()

Returns a Promise that resolves to the PushPermissionStatus of the requesting webapp, which will be one of granted, denied, or default. Replaced by PushManager.permissionState().

PushManager.register()

Subscribes to a push subscription. Replaced by PushManager.subscribe().

PushManager.registrations()

Retrieves existing push subscriptions. Replaced by PushManager.getSubscription().

PushManager.unregister()

Unregisters and deletes a specified subscription endpoint. In the updated API, a subscription is unregistered by calling the PushSubscription.unsubscribe() method.

Example

js
this.onpush = (event) => {
  console.log(event.data);
  // From here we can write the data to IndexedDB, send it to any open
  // windows, display a notification, etc.
};

navigator.serviceWorker
  .register("serviceworker.js")
  .then((serviceWorkerRegistration) => {
    serviceWorkerRegistration.pushManager.subscribe().then(
      (pushSubscription) => {
        console.log(pushSubscription.endpoint);
        // The push subscription details needed by the application
        // server are now available, and can be sent to it using,
        // for example, the fetch() API.
      },
      (error) => {
        console.error(error);
      },
    );
  });

Specifications

Specification
Push API
# pushmanager-interface

Browser compatibility

desktop mobile
Chrome
Edge
Firefox
Opera
Safari
Chrome Android
Firefox for Android
Opera Android
Safari on iOS
Samsung Internet
WebView Android
WebView on iOS
PushManager
Chrome – Full support
Chrome 42 (Release date: 2015-04-14)
footnote Full support
Edge – Full support
Edge 17 (Release date: 2018-04-30)
footnote Full support
Firefox – Full support
Firefox 44 (Release date: 2016-01-26)
footnote Full support
Opera – Full support
Opera 29 (Release date: 2015-04-28)
footnote Full support
Safari – Full support
Safari 16 (Release date: 2022-09-12)
footnote
footnote Notifications are supported on macOS Ventura and later.
Chrome Android – Full support
Chrome Android 42 (Release date: 2015-04-15)
footnote Full support
Firefox for Android – Full support
Firefox for Android 48 (Release date: 2016-08-02)
footnote Full support
Opera Android – Full support
Opera Android 29 (Release date: 2015-04-28)
footnote Full support
Safari on iOS – Full support
Safari on iOS 16.4 (Release date: 2023-03-27)
footnote
footnote Notifications are supported in web apps saved to the home screen.
Samsung Internet – Full support
Samsung Internet 4 (Release date: 2016-03-11)
footnote Full support
WebView Android – No support
WebView Android
footnote No support
WebView on iOS – No support
WebView on iOS
footnote
footnote Notifications are supported in web apps saved to the home screen.
getSubscription
Chrome – Full support
Chrome 42 (Release date: 2015-04-14)
footnote Full support
Edge – Full support
Edge 17 (Release date: 2018-04-30)
footnote Full support
Firefox – Full support
Firefox 44 (Release date: 2016-01-26)
footnote Full support
Opera – Full support
Opera 29 (Release date: 2015-04-28)
footnote Full support
Safari – Full support
Safari 16 (Release date: 2022-09-12)
footnote
footnote Notifications are supported on macOS Ventura and later.
Chrome Android – Full support
Chrome Android 42 (Release date: 2015-04-15)
footnote Full support
Firefox for Android – Full support
Firefox for Android 48 (Release date: 2016-08-02)
footnote Full support
Opera Android – Full support
Opera Android 29 (Release date: 2015-04-28)
footnote Full support
Safari on iOS – Full support
Safari on iOS 16.4 (Release date: 2023-03-27)
footnote
footnote Notifications are supported in web apps saved to the home screen.
Samsung Internet – Full support
Samsung Internet 4 (Release date: 2016-03-11)
footnote Full support
WebView Android – No support
WebView Android
footnote No support
WebView on iOS – No support
WebView on iOS
footnote
footnote Notifications are supported in web apps saved to the home screen.
hasPermission
Deprecated Non-standard
Chrome – Full support
Chrome 42 (Release date: 2015-04-14)
footnote Full support
Edge – Full support
Edge 17 (Release date: 2018-04-30)
footnote Full support
Firefox – Full support
Firefox 44 (Release date: 2016-01-26)
footnote Full support
Opera – Full support
Opera 29 (Release date: 2015-04-28)
footnote Full support
Safari – No support
Safari
footnote No support
Chrome Android – Full support
Chrome Android 42 (Release date: 2015-04-15)
footnote Full support
Firefox for Android – Full support
Firefox for Android 48 (Release date: 2016-08-02)
footnote Full support
Opera Android – Full support
Opera Android 29 (Release date: 2015-04-28)
footnote Full support
Safari on iOS – No support
Safari on iOS
footnote No support
Samsung Internet – Full support
Samsung Internet 4 (Release date: 2016-03-11)
footnote Full support
WebView Android – No support
WebView Android
footnote No support
WebView on iOS – No support
WebView on iOS
footnote No support
permissionState
Chrome – Full support
Chrome 44 (Release date: 2015-07-21)
footnote Full support
Edge – Full support
Edge 17 (Release date: 2018-04-30)
footnote Full support
Firefox – Full support
Firefox 44 (Release date: 2016-01-26)
footnote Full support
Opera – Full support
Opera 31 (Release date: 2015-08-04)
footnote Full support
Safari – Full support
Safari 16 (Release date: 2022-09-12)
footnote
footnote Notifications are supported on macOS Ventura and later.
Chrome Android – Full support
Chrome Android 44 (Release date: 2015-07-29)
footnote Full support
Firefox for Android – Full support
Firefox for Android 48 (Release date: 2016-08-02)
footnote Full support
Opera Android – Full support
Opera Android 32 (Release date: 2015-09-23)
footnote Full support
Safari on iOS – Full support
Safari on iOS 16.4 (Release date: 2023-03-27)
footnote
footnote Notifications are supported in web apps saved to the home screen.
Samsung Internet – Full support
Samsung Internet 4 (Release date: 2016-03-11)
footnote Full support
WebView Android – No support
WebView Android
footnote No support
WebView on iOS – No support
WebView on iOS
footnote
footnote Notifications are supported in web apps saved to the home screen.
register
Deprecated Non-standard
Chrome – Full support
Chrome 42 (Release date: 2015-04-14)
footnote Full support
Edge – Full support
Edge 17 (Release date: 2018-04-30)
footnote Full support
Firefox – Full support
Firefox 44 (Release date: 2016-01-26)
footnote Full support
Opera – Full support
Opera 29 (Release date: 2015-04-28)
footnote Full support
Safari – No support
Safari
footnote No support
Chrome Android – Full support
Chrome Android 42 (Release date: 2015-04-15)
footnote Full support
Firefox for Android – Full support
Firefox for Android 48 (Release date: 2016-08-02)
footnote Full support
Opera Android – Full support
Opera Android 29 (Release date: 2015-04-28)
footnote Full support
Safari on iOS – No support
Safari on iOS
footnote No support
Samsung Internet – Full support
Samsung Internet 4 (Release date: 2016-03-11)
footnote Full support
WebView Android – No support
WebView Android
footnote No support
WebView on iOS – No support
WebView on iOS
footnote No support
registrations
Deprecated Non-standard
Chrome – Full support
Chrome 42 (Release date: 2015-04-14)
footnote Full support
Edge – Full support
Edge 17 (Release date: 2018-04-30)
footnote Full support
Firefox – Full support
Firefox 44 (Release date: 2016-01-26)
footnote Full support
Opera – Full support
Opera 29 (Release date: 2015-04-28)
footnote Full support
Safari – No support
Safari
footnote No support
Chrome Android – Full support
Chrome Android 42 (Release date: 2015-04-15)
footnote Full support
Firefox for Android – Full support
Firefox for Android 48 (Release date: 2016-08-02)
footnote Full support
Opera Android – Full support
Opera Android 29 (Release date: 2015-04-28)
footnote Full support
Safari on iOS – No support
Safari on iOS
footnote No support
Samsung Internet – Full support
Samsung Internet 4 (Release date: 2016-03-11)
footnote Full support
WebView Android – No support
WebView Android
footnote No support
WebView on iOS – No support
WebView on iOS
footnote No support
subscribe
Chrome – Full support
Chrome 42 (Release date: 2015-04-14)
footnote
footnote The options parameter with a applicationServerKey value is required.
Edge – Full support
Edge 17 (Release date: 2018-04-30)
footnote
footnote The options parameter with a applicationServerKey value is required.
Firefox – Full support
Firefox 44 (Release date: 2016-01-26)
footnote
footnote From Firefox 72 onwards, can only be called in response to a user gesture such as a click event.
Opera – Full support
Opera 29 (Release date: 2015-04-28)
footnote Full support
Safari – Full support
Safari 16 (Release date: 2022-09-12)
footnote
footnote Notifications are supported on macOS Ventura and later.
Chrome Android – Full support
Chrome Android 42 (Release date: 2015-04-15)
footnote
footnote The options parameter with a applicationServerKey value is required.
Firefox for Android – Full support
Firefox for Android 48 (Release date: 2016-08-02)
footnote
footnote From Firefox Android 79 onwards, can only be called in response to a user gesture such as a click event.
Opera Android – Full support
Opera Android 29 (Release date: 2015-04-28)
footnote
footnote The options parameter with a applicationServerKey value is required.
Safari on iOS – Full support
Safari on iOS 16.4 (Release date: 2023-03-27)
footnote
footnote Notifications are supported in web apps saved to the home screen.
Samsung Internet – Full support
Samsung Internet 4 (Release date: 2016-03-11)
footnote
footnote The options parameter with a applicationServerKey value is required.
WebView Android – No support
WebView Android
footnote No support
WebView on iOS – No support
WebView on iOS
footnote
footnote Notifications are supported in web apps saved to the home screen.
supportedContentEncodings static property
Chrome – Full support
Chrome 60 (Release date: 2017-07-25)
footnote Full support
Edge – Full support
Edge 17 (Release date: 2018-04-30)
footnote Full support
Firefox – Full support
Firefox 134 (Release date: 2025-01-07)
footnote Full support
Opera – Full support
Opera 47 (Release date: 2017-08-09)
footnote Full support
Safari – Full support
Safari 16 (Release date: 2022-09-12)
footnote
footnote Notifications are supported on macOS Ventura and later.
Chrome Android – Full support
Chrome Android 60 (Release date: 2017-08-01)
footnote Full support
Firefox for Android – Full support
Firefox for Android 134 (Release date: 2025-01-07)
footnote Full support
Opera Android – Full support
Opera Android 44 (Release date: 2017-12-11)
footnote Full support
Safari on iOS – Full support
Safari on iOS 16.4 (Release date: 2023-03-27)
footnote
footnote Notifications are supported in web apps saved to the home screen.
Samsung Internet – Full support
Samsung Internet 4 (Release date: 2016-03-11)
footnote Full support
WebView Android – No support
WebView Android
footnote No support
WebView on iOS – No support
WebView on iOS
footnote
footnote Notifications are supported in web apps saved to the home screen.
unregister
Deprecated Non-standard
Chrome – Full support
Chrome 42 (Release date: 2015-04-14)
footnote Full support
Edge – Full support
Edge 17 (Release date: 2018-04-30)
footnote Full support
Firefox – Full support
Firefox 44 (Release date: 2016-01-26)
footnote Full support
Opera – Full support
Opera 29 (Release date: 2015-04-28)
footnote Full support
Safari – No support
Safari
footnote No support
Chrome Android – Full support
Chrome Android 42 (Release date: 2015-04-15)
footnote Full support
Firefox for Android – Full support
Firefox for Android 48 (Release date: 2016-08-02)
footnote Full support
Opera Android – Full support
Opera Android 29 (Release date: 2015-04-28)
footnote Full support
Safari on iOS – No support
Safari on iOS
footnote No support
Samsung Internet – Full support
Samsung Internet 4 (Release date: 2016-03-11)
footnote Full support
WebView Android – No support
WebView Android
footnote No support
WebView on iOS – No support
WebView on iOS
footnote No support

Legend

Tip: you can click/tap on a cell for more information.

Full support
Full support
No support
No support
Non-standard. Check cross-browser support before using.
Deprecated. Not for use in new websites.
See implementation notes.

See also