Register protocol: Difference between revisions

From MozillaZine Knowledge Base
Jump to navigationJump to search
m (change migration to integration)
(make this clearer and righter)
Line 1: Line 1:
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>. If a protocol is not registered, you will receive the message "protocol (foo) isn't associated with any program".


==Registering an unsupported protocol==
==Windows==
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.
On Windows, registration is done by the OS. To change the OS's settings, create a .reg file, and place this in the file:
 
===Windows===
Create the registry .reg file, replacing foo with your unregistered protocol, and the path with whatever <i>handler</i> program you want to run. Then merge it into the Windows registry.<br/>
<pre>
<pre>
REGEDIT4
REGEDIT4
Line 20: Line 17:
@="\"C:\\Program Files\\Application\\program.exe\" \"%1\""  
@="\"C:\\Program Files\\Application\\program.exe\" \"%1\""  
</pre>
</pre>
Replacing ''foo'' with the protocol you're specifying and ''C:\\Program Files\\Application\\program.exe'' with the program you want to run. 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 [http://msdn.microsoft.com/workshop/networking/pluggable/overview/appendix_a.asp Registering an Application to a URL Protocol] for additional information.
See [http://msdn.microsoft.com/workshop/networking/pluggable/overview/appendix_a.asp Registering an Application to a URL Protocol] for additional information.
 
===Linux===
Registration is unnecessary.  Simply associate whatever proto: with a program through Firefox:
Example: Add the sip: protocol to launch kphone for VoIP calls in Firefox:
- Type about:config into the address bar
- Right-click create new boolean value: '''network.protocol-handler.external.sip''' and set to '''true'''
- Right-click create new boolean value: '''network.protocol-handler.warn-external.sip''' and set to '''false'''
- Right-click create new string value: '''network.protocol-handler.app.sip''' and set to '''/usr/bin/kphone'''
 
This will actually launch kphone.  Not sure if it will dial though.  That is untested :)
 
You can also optionally register the protocol with whatever window manager you are using.  In KDE this is done through Control Center - KDE Components - File Associations.  This step is usually unnecessary unless your window manager has a custom browser, such as konqueror.


===OS X===
==Linux and Mac==
Probably very similar to Linux (above).
* 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''.


==Redirecting a registered protocol==
==Troubleshooting==
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 path or name is incorrect, the browser will display an error saying "protocol (foo) isn't associated with any program". (See [https://bugzilla.mozilla.org/show_bug.cgi?id=312953 bug 312953]).<br/>
Note: If the path or name is incorrect, the browser will display an error saying "protocol (foo) isn't
associated with any program". (See [https://bugzilla.mozilla.org/show_bug.cgi?id=312953 bug 312953]).<br/>
<br/>
You may also need to use the following prefs, although this is uncertain:<br>
<b>network.protocol-handler.external.foo</b> = <b>true</b><br/>
<b>network.protocol-handler.expose.foo</b> = <b>false</b>


[[Category:Configuration]]
[[Category:Configuration]]
[[Category:Integration with external applications - browser]]
[[Category:Integration with external applications - browser]]
[[Category:Mozilla Suite]]
[[Category:Mozilla Suite]]

Revision as of 01:58, 14 October 2006

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. If a protocol is not registered, you will receive the message "protocol (foo) isn't associated with any program".

Windows

On Windows, registration is done by the OS. To change the OS's settings, create a .reg file, and place 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\"" 

Replacing foo with the protocol you're specifying and C:\\Program Files\\Application\\program.exe with the program you want to run. 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 and Mac

  • 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

  • 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).