Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Set custom protocol handler in Firefox?

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.

like image 893
David Unric Avatar asked Mar 29 '14 10:03

David Unric


1 Answers

I had the same question, I founded 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.

like image 72
Rutrus Avatar answered Oct 05 '22 07:10

Rutrus