Register protocol: Difference between revisions

From MozillaZine Knowledge Base
Jump to navigationJump to search
m (slashes are supposed to be there)
m (caps; should this go into Category:General concepts?)
Line 1: Line 1:
= Summary =
A protocol is a method that is used to send, receive, and handle information over a connection. Common protocols viewed from the browser include <i>http</i>, <i>ftp</i>, and <i>mailto</i>. In order for you to view information sent over a specific protocol, it must be registered. Once registered, the protocol can then be handled by the program you specify, such as your browser or a 3rd party viewer. This means that a hyperlink ( e.g. foo://fred ) can use the handler for protocol <i>foo</i> to open the file named <i>fred</i>.
A protocol is a method that is used to send, receive, and handle information over a connection. Common protocols viewed from the browser include <i>http</i>, <i>ftp</i>, and <i>mailto</i>. In order for you to view information sent over a specific protocol, it must be registered. Once registered, the protocol can then be handled by the program you specify, such as your browser or a 3rd party viewer. This means that a hyperlink ( e.g. foo://fred ) can use the handler for protocol <i>foo</i> to open the file named <i>fred</i>.


=Registering an Unsupported Protocol=
=Registering an unsupported protocol=
Mozilla products utilize protocols defined internally, as well as those defined by the operating system. You can add the ability to use an unsupported protocol by registering it. The OS-specific method of doing this is described below.
Mozilla products utilize protocols defined internally, as well as those defined by the operating system. You can add the ability to use an unsupported protocol by registering it. The OS-specific method of doing this is described below.


Line 30: Line 29:
Unknown
Unknown


=Redirecting an Registered Protocol=
=Redirecting a registered protocol=
If the protocol is already handled by the browser, you can specify what program will be used as a <i>handler</i> to open the file. To do this, [[Editing_configuration|add the pref]]:<br/><b>network.protocol-handler.app.foo</b> as a string with value <b>C:\Program Files\Application\program.exe</b><br/>
If the protocol is already handled by the browser, you can specify what program will be used as a <i>handler</i> to open the file. To do this, [[Editing_configuration|add the pref]]:<br/><b>network.protocol-handler.app.foo</b> as a string with value <b>C:\Program Files\Application\program.exe</b><br/>
Note: If the path or name is incorrect, the browser will display an error saying "protocol (foo) isn't
Note: If the path or name is incorrect, the browser will display an error saying "protocol (foo) isn't

Revision as of 17:49, 4 December 2005

A protocol is a method that is used to send, receive, and handle information over a connection. Common protocols viewed from the browser include http, ftp, and mailto. In order for you to view information sent over a specific protocol, it must be registered. Once registered, the protocol can then be handled by the program you specify, such as your browser or a 3rd party viewer. This means that a hyperlink ( e.g. foo://fred ) can use the handler for protocol foo to open the file named fred.

Registering an unsupported protocol

Mozilla products utilize protocols defined internally, as well as those defined by the operating system. You can add the ability to use an unsupported protocol by registering it. The OS-specific method of doing this is described below.

Windows

Create the registry .reg file, replacing foo with your unregistered protocol, and the path with whatever handler program you want to run. Then merge it into the Windows registry.

REGEDIT4

[HKEY_CLASSES_ROOT\foo]
@="URL:foo Protocol"
"URL Protocol"=""

[HKEY_CLASSES_ROOT\foo\shell]

[HKEY_CLASSES_ROOT\foo\shell\open]

[HKEY_CLASSES_ROOT\foo\shell\open\command]
@="\"C:\\Program Files\\Application\\program.exe\" \"%1\"" 

See Registering an Application to a URL Protocol for additional information.

Linux

Unknown

OS X

Unknown

Redirecting a registered protocol

If the protocol is already handled by the browser, you can specify what program will be used as a handler to open the file. To do this, add the pref:
network.protocol-handler.app.foo as a string with value C:\Program Files\Application\program.exe
Note: If the path or name is incorrect, the browser will display an error saying "protocol (foo) isn't associated with any program". (See bug 312953).

You may also need to use the following prefs, although this is uncertain:
network.protocol-handler.external.foo = true
network.protocol-handler.expose.foo = false