手机浏览 RSS 2.0 订阅 膘叔的简单人生 , 腾讯云RDS购买 | 超便宜的Vultr , 注册 | 登陆

为自己添加协议

首页 > Software >

原文地址:http://kb.mozillazine.org/Register_protocol

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

  • (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. [4]
  • Certain unsafe protocols are ignored by default (bug 173010).

See also

 

External links

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




本站采用创作共享版权协议, 要求署名、非商业和保持一致. 本站欢迎任何非商业应用的转载, 但须注明出自"易栈网-膘叔", 保留原始链接, 此外还必须标注原文标题和链接.

Tags: 协议

« 上一篇 | 下一篇 »

发表评论

评论内容 (必填):