Communication & Background

Push Messages

Probing…

Push Messages is a web platform capability in the Communication & Background category. Server-sent push messages, even when the page is closed. Supported in Chromium 42+, Firefox 44+, and Safari 16.4+. Requires a secure context (HTTPS or localhost) and a user gesture such as a click or tap.

Secure contextUser gesture

Permission push: unknown

Try it

Loading demo…

Code

const reg = await navigator.serviceWorker.ready
let sub = await reg.pushManager.getSubscription()
if (!sub) {
  sub = await reg.pushManager.subscribe({
    userVisibleOnly: true,
    // applicationServerKey: <your VAPID public key>,
  })
}
console.log(sub.toJSON()) // send this to your push server

Browser support

Chromium
42
Firefox
44
Safari
16.4

Frequently asked questions

Which browsers support Push Messages?

Supported in Chromium 42+, Firefox 44+, and Safari 16.4+.

Does Push Messages require HTTPS?

Yes. Push Messages needs a secure context, so it only works over HTTPS (or on localhost during development).

What is Push Messages used for?

Server-sent push messages, even when the page is closed.

Can I try Push Messages in my browser?

Yes. shwcs.net runs a live Push Messages demo that probes your current browser and lets you try the API. Everything runs locally — nothing is sent anywhere.

MDN reference ↗ Specification ↗