我希望 Firefox(在 Linux 上运行)使用外部应用程序打开自定义协议(protocol)。
例如,以 gvim://
协议(protocol)名称开头的 url 应启动 gvim 并传递 url 的其余部分。
我尝试通过 Mozilla's knowledgebase 设置 network.protocol-handler.external.gvim
、network.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/