Debian – How to set downloaded Firefox to default web browser in Debian

debiandefaultsfirefoxuser-default

How do I set a manually downloaded Firefox as my default web browser so that clicking a link in another application will open the link in this Firefox?

I tried these commands, but they didn't seem to work:

update-alternatives --install /usr/bin/x-www-browser x-www-browser /home/user/firefox/firefox 100
update-alternatives --set x-www-browser /home/user/firefox/firefox

What do I have to do?

Best Answer

update-alternatives changes the application to use to open a web browser, not the application to use to open a web page. The two are not directly related: “I want to browse the web” is different from “I want to browse this web page”, and there are different kinds of content that happen to all open in a web browser.

What you need to change is which application is associated with the MIME type text/html, and perhaps others. These are configured through the /etc/mailcap file.

On Debian, /etc/mailcap is automatically generated from the applications you have installed. When multiple applications can open the same type, there is a priority system (similar, but distinct, from the priority system for alternatives). You can override these priorities by adding entries to /etc/mailcap.order. For example, the following line will cause Firefox to be used in preference of any other application for all the types it supports:

firefox:*/*

After you've changed /etc/mailcap.order, run /usr/sbin/update-mime as root to update /etc/mailcap.

If you want to use a program that doesn't come from a Debian package, edit it directly into /etc/mailcap, in the User Section.

# ----- User Section Begins ----- #
text/html; /home/user/firefox/firefox '%s'; description=HTML Text; test=test -n "$DISPLAY";  nametemplate=%s.html
# -----  User Section Ends  ----- #

If you want to set preferences for your own account, define them in ~/.mailcap: the entries in that file override the ones in /etc/mailcap. You have to put full mailcap lines there, such as

text/html; /home/user/firefox/firefox '%s'; description=HTML Text; test=test -n "$DISPLAY";  nametemplate=%s.html
Related Question