[CentOS] xdgurl

Thu Oct 20 11:06:49 UTC 2016
James Pearson <james-p at moving-picture.com>

Mark LaPierre wrote:
> Has anyone figured out how to make Firefox 45.4.0 on CentOS 6 use xdgurl
> to handle xdg:// URLs?
>
> Google is full of suggestions that don't work.  When I select a an
> xdg:// link I don't get a dialog asking me what to do like Google says I
> will.  Instead I get a message that says Firefox doesn't have a clue how
> to handle this URL.  Do you want to try again?
>
> I tried about:config
>
> I added:
>
> network.protocol-handler.external.xdg  user set  string /usr/bin/zdgurl

I don't think those types of prefs are used any more ?

A lot of the information out there on adding protocol handlers to 
Firefox on Linux is out of date or wrong ...

A couple of ways that work for me (on CentOS 6, using Gnome) with 
Firefox 45:

1. Create the file $HOME/.local/share/applications/xdg containing

[Desktop Entry]
Name=xdg
Type=Application
Exec=/usr/bin/xdgurl %U
Terminal=false
MimeType=x-scheme-handler/xdg;
NoDisplay=true

Then run:

desktop-file-install $HOME/.local/share/applications/xdgdesktop \
  --rebuild-mime-info-cache --dir=$HOME/.local/share/applications

Start firefox and browse to a xdg:// URL - it still prompts for the 
application use the first time - but after that, it should work OK

Note: I haven't actually done this for an 'xdg' protocol handler - but 
it works for launching other apps using other custom protocol handlers

2. Set up a protocol handler in a central autoconfig 'mozilla.cfg' file 
using Javascript - this is the method I use to automatically add a 
protocol handler for all users (and doesn't require any user 
intervention) - let me if you want more details about this method

James Pearson