9

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?

5

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
  • i do this but again don't work. for example in x-chat when i click on link nothing happen. – Chalist Sep 1 '12 at 22:10
1

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.

  • i do this with root access but don't work – Chalist Aug 27 '12 at 20:28
  • @chalist: Do you receive an error message? What is the output of update-alternatives --display x-www-browser? – Anju Fabulina Aug 27 '12 at 21:38
  • 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'. – Chalist Aug 28 '12 at 0:22
  • How do you see that it's not working? Which browser gets chosen when you start x-www-browser yourself? – Anju Fabulina Aug 28 '12 at 18:28
  • when i click a link in application look like choqok i will open in firefox(extracted in home) – Chalist Aug 29 '12 at 12:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.