Making Firefox use Thunderbird for web feeds

I was saving this tip for today, because it’s a bit of a Christmas present, courtesy of alta88.

Users of both Firefox and Thunderbird may have noticed that when you get the feed preview screen in Firefox 2, and use the drop-down list to add the feed to Thunderbird, it does not work. There are bugs filed for this. One that I know of, is bug 350735.

To make it work, you’ll need to close Firefox, and go into the \components\ folder, in the Firefox program directory. (eg. C:\Program Files\Mozilla Firefox\components ), and open the file FeedConverter.js in a text editor. You had better make a backup of it first. Because of the line breaks, Notepad won’t work; but Wordpad will work.

At around line 332, you’ll see text that looks like:

case "client":
var clientApp =
prefs.getComplexValue(PREF_SELECTED_APP, Ci.nsILocalFile);
//@line 393 "/cygdrive/c/builds/tinderbox/Fx-Mozilla1.8-release/WINNT_5.2_Depend/mozilla/browser/components/feeds/src/FeedConverter.js"
var ss =
Cc["@mozilla.org/browser/shell-service;1"].
getService(Ci.nsIShellService_MOZILLA_1_8_BRANCH);
ss.openApplicationWithURI(clientApp, spec);
break;

Replace that (select, copy, paste) with:

case "client":
const PREF_SELECTED_APP_ARGS = "browser.feeds.handlers.application.args";
const PREF_SELECTED_APP_URIPREFIX = "browser.feeds.handlers.application.uriPrefix";

var clientApp = prefs.getComplexValue(PREF_SELECTED_APP, Ci.nsILocalFile);
var feedhandlerArgs = safeGetCharPref(PREF_SELECTED_APP_ARGS, Ci.nsIILocalFile);
var uriPrefix = safeGetCharPref(PREF_SELECTED_APP_URIPREFIX, Ci.nsIILocalFile);

var file = Cc["@mozilla.org/file/local;1"].createInstance(Components.interfaces.nsILocalFile);
file.initWithPath(clientApp.persistentDescriptor);
var process = Cc["@mozilla.org/process/util;1"].createInstance(Components.interfaces.nsIProcess);
process.init(file);

if (uriPrefix) spec = uriPrefix + spec;
if (feedhandlerArgs)
var args = [feedhandlerArgs, spec];
else
var args = [spec];

process.run(false, args, args.length);
break;

Save and close FeedConverter.js.

Next, open Firefox and use about:config to add the following preferences:
Add the String preference browser.feeds.handlers.application.args.
Set the value to -mail.
Add the String preference browser.feeds.handlers.application.uriPrefix.
Set the value to feed:. (Include the colon.)

Enjoy, and have a merry Christmas. :)

17 Responses

  1. Kent December 24, 2006 / 3:29 pm

    You want to leave
    switch (handler) {
    in place and not replace it with the substitute text. Otherwise Firefox complains it doesn’t have an application to handle feeds: and the error console points to the line
    case “client”

  2. Chris Ilias December 24, 2006 / 3:54 pm

    My bad. I copied too much text from the original file. I fixed the post.

  3. Legithrand December 25, 2006 / 1:03 am

    that’s on Windows… and for Linux users?

  4. Josh December 26, 2006 / 1:34 pm

    Yay it worked! You are my hero of the day!

  5. Ed December 27, 2006 / 7:37 pm

    I am a bit surprised that this did not get more publicity. I dugg it but it only got 3 diggs. idk

  6. Kenneth June 23, 2008 / 12:39 pm

    How do use Thunderbird from WITHIN Firefox 3.0. I was able to in earlier Firefox.

    Thanks Kenneth

  7. DarthNihilus August 22, 2008 / 7:19 am

    What about Firefox 3? There is no code like that in FeedConverter.js

  8. Michael Staib December 2, 2008 / 12:23 am

    Those who made it to this page looking for a similar solution for Firefox 3 (as I did) may find this hack useful… be warned that it’s nowhere near as polished as the above, and not very extensively tested, but I did successfully use it to add a feed in Thunderbird. :) Around line 392, look for…
    case “client”:
    var clientApp = prefs.getComplexValue(getPrefAppForType(feedType), Ci.nsILocalFile);

    // For the benefit of applications that might know how to deal with more
    // URLs than just feeds, send feed: URLs in the following format:
    //
    // http urls: replace scheme with feed, e.g.
    // http://foo.com/index.rdf -> feed://foo.com/index.rdf
    // other urls: prepend feed: scheme, e.g.
    // https://foo.com/index.rdf -> feed:https://foo.com/index.rdf
    var ios =
    Cc[“@mozilla.org/network/io-service;1″].
    getService(Ci.nsIIOService);
    var feedURI = ios.newURI(spec, null, null);
    if (feedURI.schemeIs(“http”)) {
    feedURI.scheme = “feed”;
    spec = feedURI.spec;
    }
    else
    spec = “feed:” + spec;

    var ss =
    Cc[“@mozilla.org/browser/shell-service;1″].
    getService(Ci.nsIShellService);
    ss.openApplicationWithURI(clientApp, spec);
    break;

    And replace with…
    case “client”:
    var clientApp = prefs.getComplexValue(getPrefAppForType(feedType), Ci.nsILocalFile);
    // next five lines are new
    var feedhandlerArgs = safeGetCharPref(“browser.feeds.handlers.application.args”, Ci.nsIILocalFile);
    var file = Cc[“@mozilla.org/file/local;1″].createInstance(Components.interfaces.nsILocalFile);
    file.initWithPath(clientApp.persistentDescriptor);
    var process = Cc[“@mozilla.org/process/util;1″].createInstance(Components.interfaces.nsIProcess);
    process.init(file);

    // For the benefit of applications that might know how to deal with more
    // URLs than just feeds, send feed: URLs in the following format:
    //
    // http urls: replace scheme with feed, e.g.
    // http://foo.com/index.rdf -> feed://foo.com/index.rdf
    // other urls: prepend feed: scheme, e.g.
    // https://foo.com/index.rdf -> feed:https://foo.com/index.rdf
    //var ios =
    // Cc[“@mozilla.org/network/io-service;1″].
    // getService(Ci.nsIIOService);
    //var feedURI = ios.newURI(spec, null, null);
    //if (feedURI.schemeIs(“http”)) {
    // feedURI.scheme = “feed”;
    // spec = feedURI.spec;
    //}
    //else
    spec = “feed:” + spec;
    // next four lines are new
    if (feedhandlerArgs)
    var args = [feedhandlerArgs, spec];
    else
    var args = [spec];

    //var ss =
    // Cc[“@mozilla.org/browser/shell-service;1″].
    // getService(Ci.nsIShellService);
    //ss.openApplicationWithURI(clientApp, spec);
    process.run(false, args, args.length);
    break;

    It can probably be done much more robustly, but it seems to work for the stated purpose. Enjoy!

  9. tiren February 15, 2009 / 1:28 pm

    Hi,

    i have tried the Michale Staib’s (previous post) method for Firefox 3 but it doesn’t work for me… When i click the RSS icon in the address bar an error window appears with this message:

    “Firefox doesn’t know how to open this address, because the protocol (feed) isn’t associated with any programhael”

    Any idea?

  10. Dave February 28, 2009 / 2:26 pm

    Michael Staib – That workaround worked perfectly for me. Many thanks!

  11. コピーブランド July 29, 2009 / 6:52 am

    Great! Woo!
    I agree with you!

    Thank you for sharing this with us.

  12. Kevin September 19, 2009 / 10:59 pm

    You’ll need to also do the following:
    In Firefox go to TOOLS -> OPTIONS -> APPLICATIONS and from the list choose WEB FEED
    Set the WEB FEED to open with Thunderbird (it works also with Thunderbird portable, you must choose the executable thunderbird.exe from \app\thunderbird\)

    This is a similar hack as shown in http://www.blowyouros.com/2009/01/firefox-to-thunderbird-rss-feed-one-click-subscribe/ but for Firefox 3.5

Comments are closed.