firefox - 在 Firefox 中设置自定义协议(protocol)处理程序?

标签 firefox firefox-addon

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

例如,以 gvim:// 协议(protocol)名称开头的 url 应启动 gvim 并传递 url 的其余部分。

我尝试通过 Mozilla's knowledgebase 设置 network.protocol-handler.external.gvimnetwork.protocol-handler.app.gvim然而,当尝试打开 gvim:// url 时,Firefox 仍然会抛出未知协议(protocol)错误消息。但没有提供有关如何处理该协议(protocol)的提示。 Firefox 版本的知识库似乎已经过时。 27.

关于如何在最新的 Firefox 版本中正确配置自定义协议(protocol)处理程序,您有什么想法吗?我正在运行没有 GNOME 的 Linux。

最佳答案

我有同样的问题,我找到了一个链接,其中记录了 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 替换为您要注册的协议(protocol),将/path/to/app 替换为您要运行的应用程序的路径。

关于firefox - 在 Firefox 中设置自定义协议(protocol)处理程序?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22729686/

相关文章:

html - Firefox 显示额外的 <strong> 标签,但 html 源代码中没有?

android - 我可以使用 firefox 扩展中的 android intent 吗?

google-app-engine - Appengine 上的通配符子域通过 Firefox 上的 https

javascript - 在 window.open() 上运行 Firefox 扩展

javascript - Firefox 扩展中 JavaScript 中的 HTTP POST

javascript - 如何检测禁用插件的卸载关闭原因

firefox - 如何打包未签名的 Firefox WebExtension?

javascript - 如何在 keyCode 为只读的浏览器中聚焦下一个可聚焦字段?

http - "1970-01-01 00:00:00"过期 header

javascript - 内联 svg 作为指令(Firefox 问题)