NavigatorContentUtils
Value members
Concrete methods
The Navigator method registerProtocolHandler() lets websites register their ability to open or handle particular URL schemes (aka protocols).
The Navigator method registerProtocolHandler() lets websites register their ability to open or handle particular URL schemes (aka protocols).
For example, this API lets webmail sites open mailto: URLs, or VoIP sites open tel: URLs.
- Value parameters:
- scheme
A string containing the permitted scheme for the protocol that the site wishes to handle. For example, you can register to handle SMS text message links by passing the "sms" scheme.
- url
A string containing the URL of the handler. This URL must include %s, as a placeholder that will be replaced with the escaped URL to be handled.
- Returns:
undefined
- Throws:
- DOMException.SECURITY_ERR
The user agent blocked the registration. This might happen if:
- The registered scheme (protocol) is invalid, such as a scheme the browser handles itself (https:, about:, etc.)
- The handler URL's origin does not match the origin of the page calling this API.
- The browser requires that this function is called from a secure context.
- The browser requires that the handler's URL be over HTTPS.
- DOMException.SYNTAX_ERR
The %s placeholder is missing from the handler URL
- See also:
The Navigator method unregisterProtocolHandler() removes a protocol handler for a given URL scheme.
The Navigator method unregisterProtocolHandler() removes a protocol handler for a given URL scheme.
This method is the inverse of registerProtocolHandler().
- Value parameters:
- scheme
A string containing the permitted scheme in the protocol handler that will be unregistered. For example, you can unregister the handler for SMS text message links by passing the "sms" scheme.
- url
A string containing the URL of the handler. This URL should match the one that was used to register the handler (e.g. it must include %s).
- Returns:
undefined
- Throws:
- DOMException.SECURITY_ERR
The user agent blocked unregistration. This might happen if:
- The registered scheme (protocol) is invalid, such as a scheme the browser handles itself (https:, about:, etc.)
- The handler URL's origin does not match the origin of the page calling this API.
- The browser requires that this function is called from a secure context.
- The browser requires that the handler's URL be over HTTPS.
- DOMException.SYNTAX_ERR
The %s placeholder is missing from the handler URL
- See also: