14

I'd like Firefox (running on Linux) to open a custom protocol with an external application.

For example urls starting with gvim:// protocol name should launch gvim and pass the rest of url.

I tried to set network.protocol-handler.external.gvim, network.protocol-handler.app.gvim by Mozilla's knowledgebase however Firefox still throws unkown protocol error message when attempting to open gvim:// url. But no prompt on how to handle this protocol was offered. It seems the knowledgebase is outdated for Firefox ver. 27.

Any ideas on how to properly configure custom protocol handler in recent Firefox versions? I am running Linux without GNOME.

Just a student
  • 10,560
  • 2
  • 41
  • 69
David Unric
  • 7,421
  • 1
  • 37
  • 65

2 Answers2

11

I had the same question, I found a link which documents How to register a new protocol for Firefox.

Firefox 3.5 and above: (Works without installed Gnome libraries)

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. 

I hope you founded it earlier. I hope this info would be useful for someone in the future.

Update 2019: It seems there is new info about in the links I posted (thanks for the comment):

All Firefox versions (Requires certain Gnome libraries to be installed)

In a terminal, type:

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

Replace foo on both lines with the protocol you want to register and /path/to/app with the path to the application you want to run.

Lampe2020
  • 115
  • 1
  • 12
Rutrus
  • 1,367
  • 15
  • 27
  • 2
    It just ain't working for my latest Firefox on Peppermint Linux 7. – Stefan Reich Jul 30 '17 at 15:46
  • Thanks for the links, those worked (not the about:config thing, but using `gconftool-2`). – Luc Apr 05 '19 at 08:38
  • Other sources indicate `gconftool-2 /desktop/gnome/url-handlers/foo/needs_terminal false --type Boolean` is required. The above 2019 edit does not work in FF 70.0.1, current as at Nov 2019. – Greg Bell Nov 30 '19 at 02:15
  • 1
    This answer works for Firefox 70 : https://askubuntu.com/a/1023143. It's the best I have found so far. – Max Apr 07 '20 at 13:58
  • 1
    I can confirm this updated answer was the only one that worked for Ubuntu 16.04 and FF 88.0 – OscarHanzely May 12 '21 at 14:41
0

check extensions that do this, like https://addons.mozilla.org/en-US/firefox/addon/fosdem-basic-protocol-handl/

M.J. Saedy
  • 316
  • 4
  • 9