DOM:window.navigator.registerProtocolHandler
From MDC
This article covers features introduced in Firefox 3
Contents |
[edit] Summary
Allows web sites to register themselves as possible handlers for particular protocols.
Note: Web sites may only register protocol handlers for themselves. For security reasons, it's not possible for an extension or web site to register protocol handlers targeting other sites.
[edit] Syntax
window.navigator.registerProtocolHandler(protocol, uri, title);
-
protocolis the protocol the site wishes to handle, specified as a string. -
uriis the URI to the handler as a string. You can include "%s" to indicate where to insert the escaped URI of the document to be handled. -
titleis the title of the handler presented to the user as a string.
[edit] Example
If your web application is located at http://www.example.com, you can register a protocol handler for it to handle "mailto" like this:
navigator.registerProtocolHandler("mailto",
"https://www.example.com/?uri=%s",
"Example Mail");
This creates a handler that allows mailto links to direct the user to your web application, inserting the email address specified in the link into the URL.
[edit] Specification
Specified by the WHATWG's Web Applications 1.0 working draft.