navigator.registerProtocolHandler(scheme, url) lets a site register itself as a handler for a URL scheme such as mailto:, tel:, or a custom web+… scheme (MDN). Later, matching links can open your HTTPS template page with the original link substituted for %s.
Pass the required arguments shown below. Check return values and browser support before you rely on the result.
Syntax
Call navigator.registerProtocolHandler. Start with this line.
JavaScript
navigator.registerProtocolHandler(scheme, url)
Call
What it does
navigator.registerProtocolHandler(scheme, url)
Primary signature.
navigator.registerProtocolHandler(...)
Call with the arguments your case needs.
Built into the browser. Call registerProtocolHandler(...) on a Navigator — no import required.
Library declarations
JavaScript
navigator.registerProtocolHandler(scheme, url)
Parameters
Parameter
Description
scheme
Required. Protocol to handle (allowed list or web+)
url
Required. HTTPS same-origin template with %s
Return Value
Return Value
Description
*
Always undefined (MDN)
JavaScript Examples
Example 1 — Feature-Detect First
Limited availability + secure context — check before calling.
valid scheme: true
navigates to: https://your-origin/?burger=web%2Bburger%3Acheeseburger
How It Works
Prefix web+. Required for custom schemes (MDN).
Lowercase letters only after the prefix.
Same %s rules as mailto / listed schemes.
User confirmation may still appear before navigation.
Compatibility
Browser Support
navigator.registerProtocolHandler() has Limited availability (not Baseline) on MDN. It requires a secure context. Not Deprecated, Experimental, or Non-standard — always feature-detect.
✓ Limited availability · Not Baseline
Navigator.registerProtocolHandler()
Register URL scheme handlers with an HTTPS %s template. Support varies by browser.
MDN: it lets a website register its ability to open or handle particular URL schemes (protocols). When the user activates a matching link, the browser fills your HTTPS template URL’s %s placeholder and navigates there.
No. MDN does not mark it Deprecated, Experimental, or Non-standard. It is Limited availability (not Baseline) and requires a secure context. Always feature-detect.
An https URL of the same origin as the registering page, containing the %s placeholder that the browser replaces with the escaped URL being handled (MDN).
No. Schemes the browser already handles itself are blocked (SecurityError). Use an allowed scheme from the HTML list, or a custom scheme that begins with web+ and uses lowercase ASCII letters.
Often yes — either when registering or when the user first activates a matching link. Call registration from a clear user gesture (for example a button click).
SecurityError when the scheme or origin/https rules fail, and SyntaxError when %s is missing from the template URL. Feature-detect and wrap calls in try/catch.