WARNING: Most of this content (with the exception of the Mozilla 1.9 XPCOM reference) is very old, and can be expected to be out of date and possibly obsolete. For better XUL documentation, please visit the XUL hub at the Mozilla Developer Center.

nsIExternalProtocolService

IID:7968ffa9-bb51-4b2d-aad2-8ea46c15d27f
Inherits From:nsISupports

The external protocol service is used for finding and launching web handlers (a la registerProtocolHandler in the HTML5 draft) or platform-specific applications for handling particular protocols.

You can ask the external protocol service if it has an external handler for a given protocol scheme. And you can ask it to load the url using the default handler.

This interface is intended to be used as a service.

This interface is implemented by the following components:


Methods

PRBool externalProtocolHandlerExists ( char* protocolScheme ) AString getApplicationDescription ( AUTF8String scheme ) nsIHandlerInfo getProtocolHandlerInfo ( ACString protocolScheme ) PRBool isExposedProtocol ( char* protocolScheme ) void loadURI ( nsIURI URI , nsIInterfaceRequestor windowContext ) void loadUrl ( nsIURI URL )

PRBool externalProtocolHandlerExists ( char* protocolScheme )

Check whether a handler for a specific protocol exists. Specifically, this looks to see whether there are any known possible application handlers in either the nsIHandlerService datastore or registered with the OS.

XXX shouldn't protocolScheme be an ACString like nsIURI::scheme?

Arguments:
protocolScheme: The scheme from a url: http, ftp, mailto, etc.
Returns:
true if we have a handler and false otherwise.

AString getApplicationDescription ( AUTF8String scheme )

Gets a human-readable description for the application responsible for handling a specific protocol.

Arguments:
scheme: The scheme to look up. For example, "mms".

nsIHandlerInfo getProtocolHandlerInfo ( ACString protocolScheme )

Retrieve the handler for the given protocol. If neither the application nor the OS knows about a handler for the protocol, the object this method returns will represent a default handler for unknown content.

Note: protocolScheme should not include a trailing colon, which is part of the URI syntax, not part of the scheme itself (i.e. pass "mailto" not "mailto:").

Arguments:
protocolScheme: the scheme from a URL: http, ftp, mailto, etc.
Returns:
the handler, if any; otherwise a default handler

PRBool isExposedProtocol ( char* protocolScheme )

Check whether a handler for a specific protocol is "exposed" as a visible feature of the current application.

An exposed protocol handler is one that can be used in all contexts. A non-exposed protocol handler is one that can only be used internally by the application. For example, a non-exposed protocol would not be loaded by the application in response to a link click or a X-remote openURL command. Instead, it would be deferred to the system's external protocol handler. XXX shouldn't protocolScheme be an ACString like nsIURI::scheme?

Arguments:
protocolScheme

void loadURI ( nsIURI URI , nsIInterfaceRequestor windowContext )

Used to load a URI via an external application. Might prompt the user for permission to load the external application.

Arguments:
URI: The URI to load
windowContext: The window to parent the dialog against, and, if a web handler is chosen, it is loaded in this window as well. This parameter may be ultimately passed nsIURILoader.openURI in the case of a web handler, and windowContext is null or not present, web handlers will fail. We need to do better than that; bug 394483 filed in order to track.

void loadUrl ( nsIURI URL )

Used to load a url via an external protocol handler (if one exists)

Arguments:
URL: The url to load

Reference documentation is generated from Mozilla's source.