How to set downloaded Firefox to default web browser in Debian?
Solution 1
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
Solution 2
Run both of the commands as root (you should have received a "Permission denied" error when trying to do this without root privileges).
Now if you run (or another application runs) x-www-browser
, /home/user/firefox/firefox
should be the one that gets used.
You can also use the convenient interactive mode update-alternatives --config <name>
to set default applications instead of using --set
.
Related videos on Youtube
Chalist
Updated on September 18, 2022Comments
-
Chalist over 1 year
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?
-
Admin about 3 years- If typing
$ x-www-browser
in the terminal opens the correct browser but: -$ xdg-open https://www.example.com
opens the wrong browser application, - editing~/.config/mimeapps.list
as suggested by @Chalist and then restarting should do the trick.
-
-
Chalist over 11 yearsi do this with root access but don't work
-
Anju Fabulina over 11 years@chalist: Do you receive an error message? What is the output of
update-alternatives --display x-www-browser
? -
Chalist over 11 years
x-www-browser - manual mode link currently points to /home/user/firefox/firefox /home/user/firefox/firefox - priority 100 /usr/bin/chromium - priority 40 Current 'best' version is '/home/user/firefox/firefox'.
-
Anju Fabulina over 11 yearsHow do you see that it's not working? Which browser gets chosen when you start
x-www-browser
yourself? -
Chalist over 11 yearswhen i click a link in application look like choqok i will open in firefox(extracted in home)
-
Chalist over 11 yearsi do this but again don't work. for example in x-chat when i click on link nothing happen.