You are here: Reference > JavaScript > client-side > browser > methods > registerProtocolHandler (navigator)

registerProtocolHandler method (navigator)

Browser support:
3
Allows registering a web site as a possible handler for a protocol.
Note: The registerProtocolHandler method is supported in Firefox from version 3.
Because of security restrictions, only those web sites can be registered as protocol handlers that are located in the same domain that the page is served from.
Registered protocol handlers can be removed manually. Choose Tools/Options menu (preferences dialog on Mac). Select the Applications tab and search for the 'mailto' item. Choose 'Applications Details' from the drop-down list of 'mailto' handlers on the right side. Select and remove the required protocol handler.

Syntax:

object.registerProtocolHandler (protocol, URI, title);
You can find the related objects in the Supported by objects section below.

Parameters:

protocol
Required. String that specifies the protocol to handle.
URI
Required. String that specifies the URI to the handler. The '%s' substring will be replaced with the escaped URI that needs to be handled.
title
Required. String that specifies a title for the handler. This title will be displayed in the confirmation box when the handler is being registered.

Return value:

This method has no return value.

Example HTML code 1:

This example shows the use of the registerProtocolHandler method (note that the 'http://help.dottoro.com/protocolHandler.php' file is not a valid protocol handler, this example is only an illustration).
<head>
    <script type="text/javascript">
        function RegisterHandler () {
            navigator.registerProtocolHandler ("mailto", "http://help.dottoro.com/protocolHandler.php?uri=%s", "Dottoro mailto protocol handler");
        }
    </script>
</head>
<body>
    <button onclick="RegisterHandler ();">Register a handler for the mailto protocol!</button>
</body>
Did you find this example helpful? yes no

Supported by objects:

Related pages:

External links:

User Contributed Comments

Post Content

Post Content