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

registerContentHandler method (navigator)

Browser support:
Allows registering a web site as a possible handler for content of the specified MIME type.
Because of security restrictions, only those web sites can be registered as content handlers that are located in the same domain that the page is served from.
Registered content handlers can be removed manually. First backup the prefs.js file (this page helps to find your profile file: Profiles (Mozilla)). Open the original prefs.js file in a text editor, remove the 'browser.contentHandlers.types.X.title', 'browser.contentHandlers.types.X.type' and 'browser.contentHandlers.types.X.uri' entries where X is an integer that identifies the index of your content handler and save it.

Syntax:

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

Parameters:

MIMEtype
Required. String that specifies a MIME type to handle.
One of the following values (all values have the same effect):
application/vnd.mozilla.maybe.feed
RSS feed
application/atom+xml
RSS feed
application/rss+xml
RSS feed
URI
Required. String that specifies the Uniform Resource Identifier to the handler. The '%s' substring will be replaced with the contents.
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 registerContentHandler method (note that the 'http://help.dottoro.com/rssHandler.php' file is not a valid content handler, this example is only an illustration).
<head>
    <script type="text/javascript">
        function RegisterHandler () {
            navigator.registerContentHandler('application/vnd.mozilla.maybe.feed', 'http://help.dottoro.com/rssHandler.php?rss=%s', 'Dottoro RSS handler');

        }
    </script>
</head>
<body>
    <button onclick="RegisterHandler ();">Register a content handler for a specific mimeType!</button>
</body>
Did you find this example helpful? yes no

Supported by objects:

Related pages:

External links:

User Contributed Comments

Post Content

Post Content