JavaScript PushManager unregister() Method

Beginner
⏱️ 10 min read
📚 Updated: Jul 2026
🎯 5 Examples
🚀 5 Try-it labs
Deprecated
Non-standard
Instance method

What You’ll Learn

PushManager.unregister() is a deprecated, non-standard instance method that removed a push endpoint by URL via DOMRequest. Learn what it did, why MDN replaced it with PushSubscription.unsubscribe(), how to feature-detect it, and modern migration patterns—with five examples and try-it labs.

01

Kind

Instance method

02

Returns

DOMRequest

03

Param

pushEndpoint

04

Status

Deprecated

05

Replace

unsubscribe()

06

Spec

Non-standard

Introduction

When users disable push or your app no longer needs an endpoint, legacy Mozilla code called unregister() on PushManager with the endpoint URL to delete it from the push service.

MDN now marks it deprecated and non-standard. The standardized replacement is PushSubscription.unsubscribe() on the subscription object from getSubscription() or subscribe(). Modern PWAs should never call unregister() in new code.

⚠️
Pair with register()

MDN documented unregister() as cleanup for register(). The modern pair is subscribe() and subscription.unsubscribe().

Understanding unregister()

A legacy instance method on PushManager that unregistered and deleted a specific push endpoint.

  • ParameterspushEndpoint (endpoint URL string).
  • ReturnsDOMRequest (not a Promise).
  • Success resultPushRegistration with pushEndpoint; version is undefined.
  • Errors — handle via req.onerror.
  • Superseded byPushSubscription.unsubscribe().
  • Available in Web Workers per MDN (where still supported).

📝 Syntax

JavaScript
pushManager.unregister(pushEndpoint)

Return value

A DOMRequest object. On success, req.result describes the unregistered endpoint.

MDN legacy pattern

JavaScript
// Legacy — do not use in new code (MDN sample used navigator.push)
const req = navigator.push.unregister(pushEndpoint);

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

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

⚡ Quick Reference

GoalCode / note
Legacy unregisterpushManager.unregister(pushEndpoint)
Success handlerreq.onsuccess = () => req.result
Modern unsubscribeawait subscription.unsubscribe()
Get subscriptionawait pushManager.getSubscription()
MDN statusDeprecated · Non-standard
ReplacementPushSubscription.unsubscribe()

🔍 At a Glance

Four facts to remember about unregister().

Async
DOMRequest

Not Promise

Input
endpoint

URL string

Status
deprecated

Avoid new use

Use
unsubscribe

Instead

Examples Gallery

Examples explain legacy unregister() and show modern subscription.unsubscribe() replacements. Use View Output or Try It Yourself.

📚 Legacy Usage

How unregister() worked (historical).

Example 1 — MDN unregister() with DOMRequest

Remove an endpoint by URL using Mozilla’s legacy callback pattern.

JavaScript
const pushEndpoint = "https://push.example.com/old-endpoint";

const req = navigator.push.unregister(pushEndpoint);

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

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

How It Works

You passed the endpoint URL string—not a PushSubscription object.

Example 2 — Feature Detect Before Calling

Safe pattern for maintaining legacy codebases.

JavaScript
function legacyUnregister(pushManager, endpoint) {
  if (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()
}
Try It Yourself

How It Works

Most current browsers removed unregister()—fall back to unsubscribe().

📈 Migration & Modern Flow

Replace unregister() with subscription.unsubscribe().

Example 3 — Error Handling on DOMRequest

Log failures when endpoint removal fails.

JavaScript
const req = pushManager.unregister(pushEndpoint);

req.onsuccess = () => {
  removeEndpointFromServer(pushEndpoint);
  showPushDisabledUI();
};

req.onerror = (event) => {
  console.error("Unregister failed:", event.target.error);
};
Try It Yourself

How It Works

Modern subscription.unsubscribe() uses .catch() instead of onerror.

Example 4 — Migrate to subscription.unsubscribe() (MDN)

Recommended replacement for new push projects.

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

if (subscription) {
  const success = await subscription.unsubscribe();
  if (success) {
    console.log("Push subscription removed");
    await notifyServerUnsubscribe(subscription.endpoint);
  }
}
Try It Yourself

How It Works

unsubscribe() returns true if the subscription was successfully removed.

Example 5 — Disable Push Button Flow

User clicks “Disable Push”—unsubscribe and update UI.

JavaScript
disableBtn.addEventListener("click", async () => {
  const registration = await navigator.serviceWorker.ready;
  const subscription = await registration.pushManager.getSubscription();

  if (!subscription) {
    console.log("Already unsubscribed");
    return;
  }

  await subscription.unsubscribe();
  disableBtn.textContent = "Enable Push";
  console.log("Push disabled");
});
Try It Yourself

How It Works

This is the production pattern that replaces legacy unregister(pushEndpoint) calls.

🚀 Common Use Cases (Historical)

  • Reading old Mozilla push tutorials that call unregister().
  • Cleaning up endpoints created with deprecated register().
  • Understanding why modern code uses subscription.unsubscribe().
  • Migrating “disable notifications” UI from endpoint URLs to PushSubscription.
  • Pairing server-side endpoint deletion with client unsubscribe.

🔧 How It Works

1

Call unregister

Pass pushEndpoint URL.

Deprecated
2

DOMRequest

Attach onsuccess / onerror.

Callback
3

Endpoint removed

req.result confirms removal.

Cleanup
4

Migrate

Use subscription.unsubscribe() via Promise.

📝 Notes

  • Deprecated & non-standard on MDN—not for new production code.
  • Superseded by PushSubscription.unsubscribe().
  • Not Experimental — it was Mozilla-specific and removed from specs.
  • Requires endpoint URL — legacy API; modern API uses the subscription object.
  • Notify your server — delete stored subscription after client unsubscribe.
  • Related learning: subscribe(), getSubscription(), register(), navigator.serviceWorker, JavaScript hub.

Limited Browser Support

PushManager.unregister() is Deprecated and Non-standard on MDN. It is missing in modern browsers. Use PushSubscription.unsubscribe() instead. Logos use the shared browser-image-sprite.png sprite from this project.

Deprecated · Non-standard

PushManager.unregister()

Legacy push endpoint removal — avoid in new code.

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

Bottom line: Feature-detect before calling. Prefer subscription.unsubscribe() for removing push subscriptions.

Conclusion

pushManager.unregister() was an early way to delete a push endpoint by URL via DOMRequest. MDN deprecates it in favor of PushSubscription.unsubscribe(). Learn it for legacy code; build new features with the modern unsubscribe API.

Continue with navigator.serviceWorker, subscribe(), getSubscription(), or the JavaScript hub.

💡 Best Practices

✅ Do

  • Use subscription.unsubscribe() in new projects
  • Call from a “Disable Push” button click
  • Get subscription via getSubscription() first
  • Delete subscription on your server after unsubscribe
  • Update UI when unsubscribe succeeds

❌ Don’t

  • Call unregister() in new production code
  • Pass stale endpoint URLs without checking subscription
  • Assume DOMRequest APIs exist in modern browsers
  • Skip server cleanup after client unsubscribe
  • Confuse unregister with revoking notification permission

Key Takeaways

Knowledge Unlocked

Five things to remember about unregister()

Legacy push endpoint removal—and what to use instead.

5
Core concepts
🔄02

DOMRequest

callbacks

Returns
🔗03

endpoint

URL param

Input
🚀04

Replace

unsubscribe

Modern
🚫05

Non-standard

off spec

Spec

❓ Frequently Asked Questions

It asked the system to unregister and delete a specified push endpoint. On success, the DOMRequest result was a PushRegistration object for the removed endpoint. MDN superseded it with PushSubscription.unsubscribe().
MDN marks it Deprecated and Non-standard. It is not Experimental, but it is no longer recommended and has been superseded by subscription.unsubscribe(). Do not use it in new code.
A pushEndpoint string—the URL of the endpoint to unregister. MDN's sample used navigator.push.unregister(pushEndpoint).
Call PushSubscription.unsubscribe() on the subscription object returned by getSubscription() or subscribe(). It returns a Promise<boolean> indicating whether the subscription was removed.
A DOMRequest object (Mozilla legacy pattern)—not a Promise. Handle success with req.onsuccess and errors with req.onerror.
You may encounter it paired with register() in legacy Mozilla push tutorials. Understanding it helps you migrate safely to PushSubscription.unsubscribe() and notify your server.
Did you know?

MDN paired unregister() with register()—when you no longer needed an endpoint URL, you passed it to unregister(). Modern code calls subscription.unsubscribe() on the PushSubscription object instead.

Create push subscription

Learn subscribe()—the modern pair to unregister().

subscribe() →

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.

5 people found this page helpful