files/en-us/web/api/navigator/unregisterprotocolhandler/index.md
{{APIRef("HTML DOM")}}{{securecontext_header}}
The {{domxref("Navigator")}} method unregisterProtocolHandler() removes a protocol handler for a given URL scheme.
This method is the inverse of registerProtocolHandler().
unregisterProtocolHandler(scheme, url)
scheme
"sms" scheme.url
%s).None ({{jsxref("undefined")}}).
SecurityError {{domxref("DOMException")}}
https:, about:, etc.)SyntaxError {{domxref("DOMException")}}
%s placeholder is missing from the handler URL.For security reasons, unregisterProtocolHandler() restricts which schemes can be unregistered.
A custom scheme may be unregistered as long as:
web+web+ prefixFor example, web+burger, as shown in the Example below.
Otherwise, the scheme must be one of the following:
bitcoinftpftpsgeoimircircsmagnetmailtomatrixmmsnewsnntpopenpgp4fprsftpsipsmssmstosshtelurnwebcalwtaixmppIf your site is burgers.example.com, and you have a web+burger: scheme, you can unregister the handler for it like so:
navigator.unregisterProtocolHandler(
"web+burger",
"https://burgers.example.com/?burger=%s",
);
This script must be run from the same origin as the handler URL (so any page at https://burgers.example.com), and the handler URL must be http or https.
{{Specifications}}
{{Compat}}