navigator.registerProtocolHandler() lets a web app become a handler for schemes like mailto:, tel:, or a custom web+ protocol. Learn the scheme + URL template with %s, HTTPS same-origin rules, five examples, and try-it labs.
01
Kind
Method
02
Returns
undefined
03
Status
Limited (not Baseline)
04
Context
Secure (HTTPS)
05
Template
Must include %s
06
Typical use
Webmail / VoIP apps
Fundamentals
Introduction
When someone clicks mailto:hello@example.com, the browser usually opens a desktop mail app. A web-based protocol handler lets your site join that process.
Call registerProtocolHandler(scheme, url) from your HTTPS app. Later, when the user activates a matching link, the browser fills your template URL (replacing %s) and navigates there — often after asking for permission.
💡
No Dep / Exp / Non-standard banner
MDN marks Limited availability and a secure context, but not Deprecated, Experimental, or Non-standard. Always feature-detect and handle browser differences.
Concept
Understanding the registerProtocolHandler() Method
Two arguments — scheme (protocol name) and handler url template.
%s required — placeholder for the activated link URL (escaped).
HTTPS + same origin — handler URL must be https and match the registering page origin.
Allowed schemes — listed schemes like mailto, tel, sms, or custom web+… names.
Custom schemes — must start with web+, then at least one lowercase ASCII letter, only lowercase letters after the prefix.
Return value — undefined (side-effect API; browser may prompt the user).
Foundation
📝 Syntax
General form of the method:
JavaScript
navigator.registerProtocolHandler(scheme, url)
Parameters
scheme — protocol to handle (for example "mailto" or "web+burger").
Four facts to remember about navigator.registerProtocolHandler().
Args
scheme, url
Template needs %s
Status
Limited
Not Baseline
Context
HTTPS
Same origin
Returns
undefined
May prompt user
Compare
📋 Desktop Handler vs Web Handler
Desktop app
Web registerProtocolHandler
Example
Outlook / Mail for mailto:
Webmail at https://mail.example.org/?to=%s
Install
OS association
Site registers; browser may ask user
Navigation
Opens native app
Opens your HTTPS page with substituted URL
Support
OS-level
Limited browsers; feature-detect
Hands-On
Examples Gallery
Try It Yourself demos detect support, validate templates, and catch errors. Full registration only succeeds on HTTPS with a same-origin handler URL and an allowed scheme — browsers may also require a user gesture.
📚 Getting Started
Detect the API and understand secure-context requirements.
Example 1 — Feature Detection
Check the method and whether the page is a secure context.
navigator.registerProtocolHandler() is not Baseline. Support is strongest in some Chromium-based browsers on HTTPS. Always feature-detect, use a same-origin HTTPS template with %s, and keep a fallback for unsupported engines.
✓ Limited · Not Baseline
Navigator.registerProtocolHandler()
Register mailto / tel / web+ handlers with an HTTPS %s URL template.
LimitedNot Baseline
Google ChromeSupported with secure context / scheme rules
Supported
Microsoft EdgeFollow Chromium protocol handler support
Supported
OperaFollow Chromium where available
Supported
Mozilla FirefoxCheck current compatibility — feature-detect
Limited
Apple SafariTypically unavailable — feature-detect
Unavailable
Internet ExplorerNo modern registerProtocolHandler path
Unavailable
registerProtocolHandler()Limited
Bottom line: Detect the method, register from a user gesture on HTTPS, include %s, catch SecurityError/SyntaxError, and offer a normal link fallback.
Wrap Up
Conclusion
navigator.registerProtocolHandler() turns your HTTPS app into a handler for mailto:, tel:, or custom web+ links. Register a same-origin template with %s, expect a user confirmation, and always provide a fallback when the API is missing.
Parse the substituted URL carefully on the handler page
❌ Don’t
Try to register https / about / browser-owned schemes
Omit %s from the template
Point the handler at a different origin
Assume Baseline support in Safari / all engines
Spam registration on every page load
Summary
Key Takeaways
Knowledge Unlocked
Five things to remember about registerProtocolHandler()
Register scheme handlers with an HTTPS %s template — limited, secure-context API.
5
Core concepts
🔗01
Registers
URL schemes
mailto / web+
🔒02
Needs
HTTPS + %s
Same origin
📊03
Support
Limited
Not Baseline
👋04
UX
user may confirm
Gesture
🛡05
Errors
Security / Syntax
try/catch
❓ Frequently Asked Questions
It lets a website register itself as a handler for a URL scheme such as mailto:, tel:, or a custom web+… scheme. When the user opens that kind of link, the browser can navigate to your HTTPS template URL with the original link substituted for %s.
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.
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.
No. Schemes the browser already handles itself are blocked. 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. Always 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.
Did you know?
Custom schemes must start with web+. That prefix exists so sites cannot hijack important browser schemes like https: or about:.