JavaScript PushManager register() Method

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

What You’ll Learn

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

01

Kind

Instance method

02

Returns

DOMRequest

03

Result

endpoint URL

04

Status

Deprecated

05

Replace

subscribe()

06

Spec

Non-standard

Introduction

To send web push messages, your app needs an endpoint the push server can target. Early Mozilla push drafts exposed register() on PushManager to obtain that endpoint as a plain URL string.

MDN now marks it deprecated and non-standard. The standardized replacement is subscribe(), which returns a full PushSubscription object with endpoint URL and encryption keys. Modern PWAs should never call register() in new code.

⚠️
DOMRequest, not Promise

Legacy register() returned a Mozilla DOMRequest with onsuccess and onerror handlers—unlike modern subscribe(), which returns a Promise.

Understanding register()

A legacy instance method on PushManager that asked the system to create a new push endpoint.

  • Parameters — none.
  • ReturnsDOMRequest (not a Promise).
  • Success result — endpoint URL string.
  • Errors — handle via req.onerror.
  • Cleanup — MDN pairs with unregister() when done.
  • Superseded bysubscribe() (Baseline Widely available).
  • Available in Web Workers per MDN (where still supported).

📝 Syntax

JavaScript
pushManager.register()

Return value

A DOMRequest object. On success, req.result is the endpoint URL string.

MDN legacy pattern

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

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

req.onerror = (e) => {
  console.error(`Error getting a new endpoint: ${e.error}`);
};

⚡ Quick Reference

GoalCode / note
Legacy registerconst req = pushManager.register()
Success handlerreq.onsuccess = () => req.result
Modern subscribeawait pushManager.subscribe({ userVisibleOnly: true, applicationServerKey })
Feature detectif (pushManager.register)
MDN statusDeprecated · Non-standard
Replacementsubscribe()

🔍 At a Glance

Four facts to remember about register().

Async
DOMRequest

Not Promise

Result
URL string

Endpoint only

Status
deprecated

Avoid new use

Use
subscribe()

Instead

Examples Gallery

Examples explain legacy register() and show modern subscribe() replacements. Use View Output or Try It Yourself.

📚 Legacy Usage

How register() worked (historical).

Example 1 — MDN register() with DOMRequest

Request a new endpoint using Mozilla’s legacy callback pattern.

JavaScript
// MDN sample — navigator.push in very old Mozilla code
const req = navigator.push.register();

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

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

How It Works

Unlike Promises, you attach onsuccess and onerror to the returned request object.

Example 2 — Feature Detect Before Calling

Safe pattern for maintaining legacy codebases.

JavaScript
function legacyRegister(pushManager) {
  if (typeof pushManager.register === "function") {
    return pushManager.register();
  }
  if (navigator.push && typeof navigator.push.register === "function") {
    return navigator.push.register();
  }
  return null; // not supported — use subscribe()
}
Try It Yourself

How It Works

Most current browsers removed register()—fall back to subscribe().

📈 Migration & Modern Flow

Replace register() with subscribe() and related APIs.

Example 3 — Error Handling on DOMRequest

Log failures when endpoint registration fails.

JavaScript
const req = pushManager.register();

req.onsuccess = () => {
  sendEndpointToServer(req.result);
};

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

How It Works

Modern subscribe() uses .catch() instead of onerror.

Example 4 — Migrate to subscribe() (MDN)

Recommended replacement for new push projects.

JavaScript
const registration = await navigator.serviceWorker.ready;

const subscription = await registration.pushManager.subscribe({
  userVisibleOnly: true,
  applicationServerKey: urlBase64ToUint8Array(VAPID_PUBLIC_KEY),
});

// Full PushSubscription — endpoint + keys (not just a URL string)
console.log(subscription.endpoint);
await sendSubscriptionToServer(subscription);
Try It Yourself

How It Works

subscribe() returns encryption keys your server needs—not just an endpoint URL.

Example 5 — Modern Subscribe Flow (Check First)

Use permissionState() and getSubscription() before subscribing.

JavaScript
const registration = await navigator.serviceWorker.ready;
const pm = registration.pushManager;

const permission = await pm.permissionState({ userVisibleOnly: true });
if (permission === "denied") return;

let subscription = await pm.getSubscription();
if (!subscription) {
  subscription = await pm.subscribe({
    userVisibleOnly: true,
    applicationServerKey: vapidKey,
  });
}

console.log("Ready:", subscription.endpoint);
Try It Yourself

How It Works

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

🚀 Common Use Cases (Historical)

  • Reading old Mozilla push tutorials that call register().
  • Maintaining legacy Firefox OS apps with navigator.push.
  • Understanding why subscribe() returns more than a URL.
  • Migrating endpoint-only code to full PushSubscription objects.
  • Teaching the difference between register and getSubscription().

🔧 How It Works

1

Call register

Legacy pushManager.register().

Deprecated
2

DOMRequest

Attach onsuccess / onerror.

Callback
3

Get endpoint

req.result is URL string.

URL only
4

Migrate

Use subscribe() for endpoint + keys via Promise.

📝 Notes

  • Deprecated & non-standard on MDN—not for new production code.
  • Superseded by subscribe() (Baseline Widely available).
  • Not Experimental — it was Mozilla-specific and removed from specs.
  • DOMRequest — callback-based; unlike modern Promise APIs.
  • Pair with unregister() — MDN recommends cleanup when endpoint no longer needed.
  • Related learning: getSubscription(), permissionState(), navigator.serviceWorker, JavaScript hub.

Limited Browser Support

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

Deprecated · Non-standard

PushManager.register()

Legacy push endpoint registration — avoid in new code.

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

Bottom line: Feature-detect before calling. Prefer subscribe() for new push subscription setup.

Conclusion

pushManager.register() was an early way to obtain a push endpoint URL via DOMRequest. MDN deprecates it in favor of subscribe(), which returns a full PushSubscription with keys. Learn it for legacy code; build new features with the modern Push API.

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

💡 Best Practices

✅ Do

  • Use subscribe() in new projects
  • Check permissionState() before subscribing
  • Call getSubscription() to avoid duplicate subs
  • Feature-detect register in legacy maintenance
  • Send full PushSubscription JSON to your server

❌ Don’t

  • Call register() in new production code
  • Assume DOMRequest APIs exist in modern browsers
  • Store only endpoint URLs without encryption keys
  • Skip unregister() cleanup in legacy code
  • Confuse register with permission checks

Key Takeaways

Knowledge Unlocked

Five things to remember about register()

Legacy push endpoint registration—and what to use instead.

5
Core concepts
🔄02

DOMRequest

callbacks

Returns
🔗03

URL only

endpoint

Result
🚀04

Replace

subscribe()

Modern
🚫05

Non-standard

off spec

Spec

❓ Frequently Asked Questions

It asked the system to request a new push notification endpoint. On success, the DOMRequest result was a string URL. MDN superseded it with subscribe(), which returns a full PushSubscription object.
MDN marks it Deprecated and Non-standard. It is not Experimental, but it is no longer recommended and has been superseded by subscribe(). Do not use it in new code.
A DOMRequest object (Mozilla legacy pattern)—not a Promise. Handle success with req.onsuccess and errors with req.onerror. The result is an endpoint URL string.
Use PushManager.subscribe() after navigator.serviceWorker.ready. subscribe() returns a Promise<PushSubscription> with endpoint and encryption keys for your push server.
No. MDN documents register() with no parameters. Call it on a PushManager instance—or in very old Mozilla samples, via navigator.push.register().
You may encounter it in legacy Firefox OS or old Mozilla push tutorials. Understanding it helps you migrate safely to subscribe() and getSubscription().
Did you know?

MDN’s register() sample used navigator.push.register()—a very old Mozilla entry point. Modern code uses registration.pushManager.subscribe() instead.

Register service workers

Learn navigator.serviceWorker—required before subscribe() in modern PWAs.

serviceWorker →

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