在Firefox中设置自定义协议处理程序

时间:2014-03-29 10:12:11

标签: firefox firefox-addon

我希望Firefox(在Linux上运行)使用外部应用程序打开自定义协议。

例如,以gvim://协议名称开头的网址应该启动gvim并传递其余网址。

我尝试按Mozilla's knowledgebase设置network.protocol-handler.external.gvimnetwork.protocol-handler.app.gvim但是在尝试打开gvim://网址时,Firefox仍然会抛出 unkown protocol 错误消息。但没有提供如何处理该协议的提示。对于Firefox版本来说,知识库似乎已经过时了。 27。

有关如何在最近的Firefox版本中正确配置自定义协议处理程序的任何想法?我在没有GNOME的情况下运行Linux。

2 个答案:

答案 0 :(得分:6)

我有同样的问题,我创建了一个文档how to register a new protocol for firefox的链接。

Firefox 3.5及更高版本:(没有安装Gnome库的工作)

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. 

我希望你早点成立它。我希望这些信息对将来的某些人有用。

更新2019年: 似乎在我发布的链接中有新的信息(感谢评论):

所有Firefox版本(需要安装某些Gnome库)

在终端中输入:

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

使用您要注册的协议替换两行上的foo,并使用您要运行的应用程序的路径替换/ path / to / app。

答案 1 :(得分:1)

相关问题