navigator.unregisterProtocolHandler() removes a protocol handler your site registered earlier. Learn the matching scheme + %s URL rules, HTTPS same-origin requirements, five examples, and how it pairs with registerProtocolHandler().
01
Kind
Method
02
Returns
undefined
03
Status
Limited (not Baseline)
04
Context
Secure (HTTPS)
05
Pair with
registerProtocolHandler
06
Must match
Same scheme + URL
Fundamentals
Introduction
After a site calls registerProtocolHandler(), the browser may open mailto:, tel:, or custom web+ links in that web app. When the user turns the feature off — or your settings page offers “Stop handling these links” — call unregisterProtocolHandler().
Pass the same scheme and the same handler URL template (including %s) that were used at registration time. The method returns undefined and may throw if the scheme or URL rules fail.
💡
No Dep / Exp / Non-standard banner
MDN marks Limited availability and a secure context, but not Deprecated, Experimental, or Non-standard. Learn registration first: registerProtocolHandler().
Concept
Understanding the unregisterProtocolHandler() Method
Two arguments — scheme and handler url (must include %s).
Exact match — URL should match what was registered.
HTTPS + same origin — call from a secure page whose origin matches the handler URL.
Allowed schemes — same list as registration (mailto, sms, web+…, …).
Blocked schemes — browser-owned schemes like https / about cannot be unregistered this way.
Return value — undefined (side-effect API).
Foundation
📝 Syntax
General form of the method:
JavaScript
navigator.unregisterProtocolHandler(scheme, url)
Parameters
scheme — protocol to unregister (for example "sms" or "web+burger").
url — handler template URL that includes %s and matches registration.
// Must run on https://burgers.example.com (same origin as the handler URL)
navigator.unregisterProtocolHandler(
"web+burger",
"https://burgers.example.com/?burger=%s"
);
Four facts to remember about navigator.unregisterProtocolHandler().
Args
scheme, url
Must include %s
Status
Limited
Not Baseline
Context
HTTPS
Same origin
Inverse of
register…
Same template
Compare
📋 register vs unregister
registerProtocolHandler()
unregisterProtocolHandler()
Purpose
Add a web handler
Remove that handler
Arguments
scheme, url with %s
Same pair (exact match)
User prompt
Often on register / first use
Usually quieter; still secure-context rules
Typical UI
“Use this site for mailto links”
“Stop handling these links”
Hands-On
Examples Gallery
Demos detect support, validate templates, and catch errors. Full unregister only works on HTTPS with a same-origin handler URL that previously matched a registration. Try It Yourself labs are safe to run — they may report missing API or SecurityError in the editor origin.
📚 Getting Started
Detect both APIs and see the MDN unregister pattern.
Example 1 — Feature Detection
Check register / unregister methods and secure context together.
registerProtocolHandler: available
unregisterProtocolHandler: available
isSecureContext: true
origin: https://…
(or missing / insecure-context on some setups)
How It Works
If unregister is missing, hide the “Stop handling links” button in your settings UI.
Example 2 — Unregister web+burger (MDN)
Custom scheme pattern from MDN. In production, use your real origin.
JavaScript
function unregisterBurgerHandler() {
if (typeof navigator.unregisterProtocolHandler !== "function") {
return "API not supported";
}
if (!window.isSecureContext) {
return "Needs HTTPS / localhost";
}
try {
// Demo: build a same-origin template (must match what you registered)
const handler = location.origin + "/?burger=%s";
navigator.unregisterProtocolHandler("web+burger", handler);
return "Unregister requested for web+burger → " + handler;
} catch (err) {
return "Error: " + err.name + " — " + err.message;
}
}
console.log(unregisterBurgerHandler());
navigator.unregisterProtocolHandler() is not Baseline. Support tracks the protocol-handler feature set (strongest in Chromium-based browsers). Always feature-detect, use HTTPS, and keep a clear fallback when the API is missing.
✓ Limited · Not Baseline
Navigator.unregisterProtocolHandler()
Remove a previously registered scheme handler (same URL template).
LimitedNot Baseline
Google ChromeProtocol handlers where supported
Limited
Microsoft EdgeFollow Chromium support
Limited
OperaFollow Chromium where available
Limited
Mozilla FirefoxCheck current protocol-handler support
Limited
Apple SafariTypically unavailable — feature-detect
Unavailable
Internet ExplorerNo modern protocol-handler API
Unavailable
unregisterProtocolHandler()Limited
Bottom line: Detect the method, pass the exact scheme + %s URL used at registration, call from HTTPS same-origin pages, and wrap calls in try/catch.
Wrap Up
Conclusion
navigator.unregisterProtocolHandler() is how a web app stops handling a URL scheme. Use the same scheme and %s template you registered, call it on HTTPS from the same origin, and always feature-detect.
Five things to remember about unregisterProtocolHandler()
Limited inverse of registerProtocolHandler — same scheme and %s URL.
5
Core concepts
🚫01
Removes
scheme handlers
Inverse
📊02
Support
Limited
Not Baseline
🔒03
Needs
HTTPS
+ same origin
🔗04
Match
exact URL
Includes %s
⚠05
Errors
Security / Syntax
try/catch
❓ Frequently Asked Questions
It removes a previously registered protocol handler for a given scheme and handler URL template. It is the inverse of navigator.registerProtocolHandler().
No. MDN does not mark it Deprecated, Experimental, or Non-standard. It is Limited availability (not Baseline) and requires a secure context. No status banner is required.
Yes. Pass the same scheme and the same handler URL (including %s) that were used with registerProtocolHandler(). Mismatches will not remove the handler.
Yes. The API is a secure-context feature. The handler URL must also be http/https and same-origin as the page calling unregister.
SecurityError when the scheme is blocked, the origin/https rules fail, or the context is insecure. SyntaxError when %s is missing from the handler URL.
The same permitted list as registration: schemes like mailto, tel, sms, bitcoin, and custom web+… names that follow the lowercase ASCII rules.
Did you know?
Unregistering does not invent a new URL format — browsers look for the same scheme + template pair you registered. Keep that string in one shared constant so register and unregister never drift apart.