window.navigator.registerProtocolHandler

« Referência do DOM

Summary

Allows web sites to register themselves as possible handlers for particular protocols.

Syntax

window.navigator.registerProtocolHandler(protocol, uri, title);
  • protocol is the protocol the site wishes to handle, specified as a string.
  • uri is 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.
  • title is the title of the handler presented to the user as a string.

Example

navigator.registerProtocolHandler("mailto",
                                 "https://mail.google.com/mail?view=cm&tf=0&to=%s",
                                 "Google Mail");

This creates a handler that allows mailto links to direct the user to Google Mail, inserting the email address specified in the link into the URL.

Specification

Specified by the WHATWG's Web Applications 1.0 working draft.

Categorias

Interwiki Language Links

Document Tags and Contributors

Contributors to this page: Verruckt, Leandro Mercês Xavier
Last updated by: Verruckt,