Novell Home

Forcing Thunderbird to Open Hyperlinks in Firefox

Novell Cool Solutions: Feature
By Scott M. Morris

Rate This Page

Reader Rating  stars  from 11 ratings

Digg This - Slashdot This

Posted: 29 Aug 2005
 

Applies to:

  • Platforms using KDE 3.4
  • Platforms using Firefox
  • Platforms using Thunderbird

I ran into a problem the other day that I'd like to share. I'll also provide the solution that I found. The problem was that for the life of me, I could not get Thunderbird to open hyperlinks using Firefox as the browser. I had the KDE Control Panel set to use Firefox as my browser. I also had .htm and .html files set to be opened with Firefox. So why wouldn't Thunderbird open links in Firefox?

The solution is essentially to manually tell Thunderbird what to do, and where Firefox is. The first thing that we are going to do is to create a shell script. This script opens a URL in Firefox:

#!/bin/bash

url="$1"
if [ "x$url" = "x" ]; then
url="about:blank"
fi

exec /usr/bin/firefox "$url"

Make sure the line that says /usr/bin/firefox indeed points to the location of Firefox on your system.

Save this script as openlink.sh in the .thunderbird subdirectory of your home directory. For me, this path is /home/scott/.thunderbird/openlink.sh though yours will probably have your username instead of "scott."

Now, make that script executable. Open a command prompt and type the following command, substituting "scott" for your username:

[1808][smorris@linux:~]$ chmod +x /home/scott/.thunderbird/openlink.sh
[1808][smorris@linux:~]$ 

Slick, now we can tell Thunderbird to call this script when we click on a hyperlink. First, make sure Thunderbird is not running. Next, edit the /home/scott/.thunderbird/[some profile name].default/prefs.js in your favorite text editor. The "[some profile name]" will be a random combination of letters and numbers.

At the bottom of this file, edit the following entries (if they are not there, add them):

user_pref("network.protocol-handler.app.ftp", "/home/scott/.thunderbird/openlink.sh");
user_pref("network.protocol-handler.app.http", "/home/scott/.thunderbird/openlink.sh");
user_pref("network.protocol-handler.app.https", "/home/scott/.thunderbird/openlink.sh");

Obviously, you will switch out "scott" in the paths with your own username.

Once this is all done, you are finished. When you fire up Thunderbird and click a link, it should always open it in Firefox.

Reader Comments

  • Thanks for the info, exactly the settings that were needed. These should be predefined to use /usr/bin/firefox by default. I don't entirely see the use of creating another shell script, the one provided by firefox seems to work just fine.
  • Very nice article. I might suggest changing the paths, however, from something like /home/scott/.thunderbird/yadda to ~/.thunderbird/yadda. Makes everything user agnostic.
  • Select Default Browser in Preferences
  • Nice to see, but the script you suggest is inefficient, and won't produce expected behaviour with Firefox's "Open links from other applications in:" preference in Advanced->Tabbed Browsing. A better script to use would read as follows: #!/bin/bash exec /usr/bin/firefox -remote "openurl($1)" This opens URLs in a way that honours Firefox preferences, and behaves correctly when the URL is blank.
  • Exactly what I was searching for!
  • This page gave me a clue to find a better solution. Thunderbird uses the "alternatives" mechanism (on Debian systems at least) to select the appropriate browser to use when a hyperlink is activated. In a terminal, type in the following command: $ sudo update-alternatives --config x-www-browser Type in your password if prompted to. This command will display a numbered list. Enter the number corresponding to Firefox. Now, when you click a hyperlink in Thunderbird, it will open Firefox. I hope this comment helps. Gauthier Haderer

Novell Cool Solutions (corporate web communities) are produced by WebWise Solutions. www.webwiseone.com

Novell® Making IT Work As One

© 2009 Novell, Inc. All Rights Reserved.