JavaScript PushManager unregister() Method

Beginner
5 min read
Updated: Nov 2026
4 examples
Method

Definition

PushManager.unregister(pushEndpoint) was a legacy instance method that asked the system to unregister and delete a specified push endpoint. It returned a DOMRequest; on success, req.result was a PushRegistration for the removed endpoint (MDN).

Pass the required arguments shown below. Check return values and browser support before you rely on the result.

Syntax

Call pushManager.unregister. Start with this line.

JavaScript
pushManager.unregister(pushEndpoint)
CallWhat it does
pushManager.unregister(pushEndpoint)Primary signature.
pushManager.unregister(...)Call with the arguments your case needs.

Built into the browser. Call unregister(...) on a PushManager — no import required.

Library declarations
JavaScript
pushManager.unregister(pushEndpoint)

Parameters

ParameterDescription
pushEndpointRequired. URL string of the endpoint to delete
DOMRequest handlersRequired. onsuccess / onerror
Feature detectRequired. Missing in modern browsers

Return Value

Return ValueDescription
*DOMRequest (not a Promise)

JavaScript Examples

Example 1 — MDN unregister() Pattern

Remove a known endpoint with a DOMRequest.

JavaScript
const pushEndpoint = "https://push.example.com/abc";
const req = navigator.push.unregister(pushEndpoint);

req.onsuccess = () => {
  console.log(`Unregistered endpoint: ${req.result.pushEndpoint || pushEndpoint}`);
};

req.onerror = (e) => {
  console.error(`Error unregistering the endpoint: ${e.error}`);
};
Try It Yourself

How It Works

  1. Pass the endpoint URL. Legacy APIs removed one endpoint at a time by string.
  2. Get a DOMRequest. Not a Promise — attach onsuccess / onerror.
  3. Read the result. Success yields a PushRegistration; version is undefined (MDN).
  4. Handle failure. Log e.error when the system cannot unregister.

Example 2 — Feature Detect Before Calling

Safe pattern when you must touch legacy codepaths.

JavaScript
function legacyUnregister(pushManager, endpoint) {
  if (pushManager && typeof pushManager.unregister === "function") {
    return pushManager.unregister(endpoint);
  }
  if (navigator.push && typeof navigator.push.unregister === "function") {
    return navigator.push.unregister(endpoint);
  }
  return null; // not supported — use subscription.unsubscribe()
}

const req = legacyUnregister(null, "https://push.example.com/abc");
console.log(req === null ? "use unsubscribe()" : "legacy available");
Try It Yourself

How It Works

  1. Check the method. Only call if typeof … === "function".
  2. Cover both hosts. Old samples used navigator.push; some drafts used pushManager.
  3. Return null when missing. That is the common case in modern browsers.
  4. Fall forward. Treat null as a signal to use subscription.unsubscribe().

Example 3 — Migrate to unsubscribe()

Recommended replacement for new push projects.

JavaScript
const registration = await navigator.serviceWorker.ready;
const subscription = await registration.pushManager.getSubscription();

if (subscription) {
  const removed = await subscription.unsubscribe();
  console.log(removed ? "Unsubscribed" : "Already gone");
} else {
  console.log("No subscription to remove");
}
Try It Yourself

How It Works

  1. Wait for the worker. serviceWorker.ready exposes pushManager.
  2. Read the subscription. getSubscription() returns the object or null.
  3. Call unsubscribe. Returns a Promise that resolves to true when removed.
  4. Handle null. Nothing to remove — update UI to “Enable Push”.

Example 4 — Unsubscribe and Clean Up the Server

Removing the browser subscription is only half the job.

JavaScript
const registration = await navigator.serviceWorker.ready;
const subscription = await registration.pushManager.getSubscription();

if (subscription) {
  const endpoint = subscription.endpoint;
  const removed = await subscription.unsubscribe();
  if (removed) {
    await fetch("/api/push-subscription", {
      method: "DELETE",
      headers: { "Content-Type": "application/json" },
      body: JSON.stringify({ endpoint }),
    });
    console.log("Server record deleted");
  }
}
Try It Yourself

How It Works

  1. Capture the endpoint. Save it before unsubscribe() clears the subscription.
  2. Unsubscribe locally. The browser stops accepting pushes for this app.
  3. DELETE on the server. Prevents failed sends to a dead endpoint.
  4. Confirm. Log success so the UI can show “Enable Push” again.

Browser Support

PushManager.unregister() is Deprecated and Non-standard on MDN. It is missing or removed in modern browsers. Prefer PushSubscription.unsubscribe().

✓ Deprecated · Non-standard

PushManager.unregister()

Legacy push endpoint removal — avoid in new code. Use subscription.unsubscribe() instead.

Legacy Deprecated API
Google Chrome Not supported — use unsubscribe()
Not supported
Mozilla Firefox Legacy only — use unsubscribe()
Legacy only
Apple Safari Never supported — use unsubscribe()
Not supported
Microsoft Edge Follow Chromium — use unsubscribe()
Not supported
Opera Follow Chromium
Not supported
Internet Explorer No Push API
Not supported
unregister() Limited

Bottom line: Feature-detect before calling. Build disable-push flows with getSubscription() then subscription.unsubscribe(), and delete the server record.

Frequently Asked Questions

It asked the system to unregister and delete a specified push endpoint. On success, the DOMRequest result was a PushRegistration for the removed endpoint. MDN superseded it with PushSubscription.unsubscribe().
Yes. MDN marks it Deprecated and Non-standard. It is not Experimental. Prefer subscription.unsubscribe() in new code.
A pushEndpoint string — the URL of the endpoint to remove. MDN’s sample used navigator.push.unregister(pushEndpoint).
A DOMRequest object (legacy Mozilla pattern), not a Promise. Handle success with req.onsuccess and errors with req.onerror.
Call PushSubscription.unsubscribe() on the object from getSubscription() or subscribe(). It returns a Promise that resolves to a boolean.
You may see it paired with register() in old Mozilla push samples. Knowing it helps you migrate to unsubscribe() and update your server.

Next: getSubscription()

Learn how to read the current subscription before you unsubscribe.

getSubscription() tutorial →

About the author

Mari Selvan M P
Mari Selvan M P 🔗

Developer, cloud engineer, and technical writer

  • Experience 12 years building web and cloud systems
  • Focus Full Stack Development, AWS, and Developer Education

I write practical tutorials so students and working developers can learn by doing—from databases and APIs to deployment on AWS.

8 people found this page helpful