Register protocol

From MozillaZine Knowledge Base
Jump to navigationJump to search

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, https, ftp, and mailto. In order for you to view information sent over a specific protocol, it must be registered. If you enter a URL for an unknown protocol (foo) in the Location Bar, you will receive a message such as, Firefox doesn't know how to open this address, because the protocol (foo) isn't associated with any program or, in Mozilla Suite/SeaMonkey, foo not a registered protocol.

Once registered, the protocol can then be handled by the program you specify, such as your browser or a third party viewer. This means that a hyperlink ( e.g. foo://fred) can use the handler for protocol foo to open the file named fred.

Windows

On Windows, protocol registration is done by the operating system (OS). For example, when you set a web browser as the default browser, the OS will register the http, https and ftp protocols and associate them with that web browser; when you open an http https or ftp link in a mail message or from an Internet Shortcut, the URL will open in your default browser. Similarly, when you set a default mail client, the OS registers the mailto protocol so that mailto links in the browser open in the associated mail application.

Note: Mozilla Suite/SeaMonkey integrates mail and browser functions so that web links in an email message (e.g., http:// links) will open in a SeaMonkey browser window and "mailto:" links in a web page will open in SeaMonkey Mail, regardless of the OS protocol handlers.

Other protocols can be registered and associated with an external application by configuring an installed program to handle the content. For example, you can set RealPlayer as the registered protocol handler for RTSP URLs (Real-Time Streaming Protocol) by using RealPlayer's preference settings under "Content -> Media Types". When you next open an rtsp:// link, Firefox or Mozilla Suite/SeaMonkey will ask you to confirm the external protocol request before it will launch the application [1] [2].

It is also possible to register a protocol by creating a .reg file such as the following, and placing this in the file:

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\"" 

Replace foo with the protocol you're specifying and C:\\Program Files\\Application\\program.exe with the program you want to run. [3] Note that backslashes must be doubled and the additional slashes and quotes before the path must not be removed. Save the file, then double-click it to insert into the Windows registry. See Registering an Application to a URL Protocol for additional information.

Linux

All Firefox versions

(Requires certain Gnome libraries to be installed)

  • In a terminal, type:
gconftool-2 -s /desktop/gnome/url-handlers/foo/command '/path/to/app %s' --type String
gconftool-2 -s /desktop/gnome/url-handlers/foo/enabled --type Boolean true

Replace foo on both lines with the protocol you want to register and /path/to/app with the path to the application you want to run.

Firefox 3.5 and above

(Works without installed Gnome libraries)

  • Type about:config into the Location Bar (address bar) and press Enter.
  • Right-click -> New -> Boolean -> Name: network.protocol-handler.expose.foo -> Value -> false (Replace foo with the protocol you're specifying)
  • Next time you click a link of protocol-type foo you will be asked which application to open it with.

Firefox versions up to 3.0

(Works without installed Gnome libraries)

  • Type about:config into the Location Bar (address bar) and press Enter.
  • Right-click -> New -> Boolean -> Name: network.protocol-handler.external.foo -> Value -> true (Replace foo with the protocol you're specifying)
  • Right-click -> New -> String -> Name: network.protocol-handler.app.foo -> Value -> /path/to/app (Replace foo with the protocol you're specifying and /path/to/app with the path to the application you want to run)
  • Ensure network.protocol-handler.expose-all is set to true.

Mac

Firefox versions up to 3.0:

  • Type about:config into the address bar and press Enter.
  • Right-click -> New -> Boolean -> Name: network.protocol-handler.external.foo -> Value -> true (Replacing foo with the protocol you're specifying)
  • Right-click -> New -> String -> Name: network.protocol-handler.app.foo -> Value -> /path/to/app (Replacing foo with the protocol you're specifying and /path/to/app with the path to the application you want to run.
  • Ensure network.protocol-handler.expose-all is set to true.

Troubleshooting

  • (Linux and Mac) If the path or name is incorrect when setting the network.protocol-handler.app.(protocol) preference , Firefox will display an error saying "protocol (foo) isn't associated with any program". (bug 312953)
  • If you receive a message in Firefox that the mailto protocol is not associated with any program, reset your default mail client.
  • Certain unsafe protocols are ignored by default (bug 173010).

See also


External links

The protocol is not associated with any program (Firefox Support)