There are several ways to control what browser will open links, and a given application can also choose to prefer a different method, apart from the usual conventions.
If you are clicking on an html file from the desktop or from within Nautilus, you can control how the browser will open it by right-clicking on the HTML document and choosing properties.
From the command line, try sudo update-alternatives --config x-www-browser
.
This uses Debian's alternatives system. It will present you with a list of reasonable options from which you can choose to select.
To see what is available to the alternatives system, you will use the --list
argument on the target component. For example:
% update-alternatives --list x-www-browser
/usr/bin/chromium-browser
/usr/bin/epiphany-browser
/usr/bin/firefox
/usr/bin/firefox-4.0
/usr/bin/google-chrome
/usr/bin/midori
This can be different from the Gnome 'Preferred Applications' setting. Another potential source of conflict exists if you have the BROWSER environment variable set. You can see if you have anything defined for it by typing env | grep BROWSER
.
It appears that xdg-open and gnome-open don't follow the settings in the alternatives list. sensible-browser
(which can be also launched via the command-line or from a script) does, but xdg-open and gnome-open should already be looking at the choice you made in 'Preferred Application.' (This should be the same GUI you get when running gnome-default-applications-properties
.)
xdg-open basically just looks to see which desktop environment you have and then runs gnome-open, gvfs-open, xfce-open, etc. See below for desktop environment specific instructions...
Gnome
Gnome uses the gnome-open program which uses gconf to store everything. For example on my machine with Ubuntu 10.10 running gnome-open irc://blah opens up xchat because xchat includes a gconf setting patch to add an irc:// handler.
This shows how gnome does this, with a gconf settings in /desktop/gnome/url-handlers/
. See xchat-2.8.8/src/common/dbus/apps_xchat_url_handler.schemas
as an example.
KDE
For KDE you should look at the .protocol files in /usr/share/kde4/services/, create a new one for your new protocol and put it in ~/.kde/share/kde4/services/, if it's super useful then consider adding it to the package as a fix for other users.
KDE is using kde-open or kfmclient depending on what's available and what version of KDE you have.
XFCE
XFCE uses a program called exo-open, this program doesn't have any way to configure it or add uri handlers. Looking through the source code shows that is uses desktop files to specify only three types of programs. TerminalEmulator, WebBrowser and EmailClient.
With XFCE4 (and probably also others) it is possible to configure xdg-open to define a custom protocol handler. In some you have to create/edit the following files:
~/.local/share/applications/protocolhandler.desktop
~/.local/share/applications/mimeapps.list
An example adding a handler for the ed2k protocol is provided at stackexchange.com2.
Best Answer
Chromium also has an option in its preferences to make it the default browser:
That should work, but it if doesn't, read on:
There are several keys in the GConf database that determine what browser is launched by
xdg-open
:/desktop/gnome/url-handlers/unknown/command
/desktop/gnome/url-handlers/http/command
/desktop/gnome/url-handlers/https/command
/desktop/gnome/url-handlers/about/command
Make sure they are all set correctly:
gconf-editor
/usr/bin/chromium-browser %s
.