Have you ever got used to a Firefox or Thunderbird addon that you really like, or just can't live without, and then a new version of either Firefox or Thunderbird is released, and suddenly your addon no longer works?
Of course, the generally recommended way is to search http://addon.mozilla.org for a new version, but sometimes when you try to update your addons, you find there is no new version, or it seems like nobody is maintaining the addon any more. I tend to live on the leading edge of new Firefox releases, I want the new features, I want the latest, and I want it now, so I quite frequently hit this problem. Fortunately, there is an easy way to keep using your favorite addons, usually with little or no risk.
Before my instructions on hacking an add-on however, if you want an easy way out and don't mind the overhead of yet another add-on (which in my mind performs very little useful purpose, but you are welcome to your opinion on the matter), and don't mind the following Mozilla.org recommendation, "Note: Recommended for alpha and beta users only!", you can install an official Mozilla add-on, the Add-on Compatibility Reporter. If this suits your needs and you can live with the overhead, wonderful. Read no further, go ahead and install the add-on. If like me, you prefer to minimize your add-ons to optimize resource utilization (read memory and CPU cycles), then you might prefer to try my method.
The first version of this add-on, version 0.1 was released in October 2009, ten months after my initial posting of this article. They are now at version 1.0.2 which should by now be reasonably mature and stable, but reading some of the comments posted by users of the add-on, and the Mozilla recommendation as to the intended user of the add-on, I am no more interested than when this add-on was first mentioned to us.
The summary for those who just want to skim and jump in:
- Download the addon file you want to update
- Rename the addon archive file to add .zip to the end
- Extract install.rdf
- Edit install.rdf, find and change maxVersion, save the change
- Pack install.rdf back into the install archive
- Rename the file back to it's original .xpi name
- Install by dragging and dropping the modified .xpi file, or for older versions of Firefox and Thunderbird if drag and drop is not supported, install using using the menu options File, Open, and choose the modified .xpi file.
The detail for those who need all the steps:
You will need only two free tools to help you do this job, and in this age I think it is reasonably safe to assume that virtually every user already has a copy of WinZip, the totally free 7-Zip or some other ZIP file management utility and hopefully knows how to use it. The other tool is a simple text editor. Microsoft's Notepad will do, but any other text editor will work if you have any particular preference. My preference is NotePad++ which is a good free programming and general purpose text editor.
A warning is the first important note here; always backup your Firefox or Thunderbird installation directory before doing any "hacking". While a problem is extremely rare, problems can happen, and you will only have yourself to blame if you don't take appropriate precautions before making any unsupported changes. I won't take any responsibility for any problems you inflict on yourself through sharing with you what I do on my own computer(s). It is often a good practice anyway to backup your installation directory before installing any new addon, just because you never really know what can happen, though usually by the time anything is approved and available for public download on http://addon.mozilla.org, it has been fairly well tested by others and proved to be safe. At the very least, before following my tips here, backup your profile and addons directories by making a copy of them to some other location on your disk. If you don't know how to do that, or don't know where your profile and other directories (folders) are, I don't suggest you try my tricks. Read Gizmo's article How to Back up Mozilla Firefox and Thunderbird, in which among other things Gizmo mentions using tools such as MozBackup which shields you for knowing how to do it manually.
Once you have taken your backup, the first step is to find and download the latest version of the addon you want, and download a copy to your disk. Remember, at this point you can not simply click the Install link, because you know the installer will tell you the addon is unsupported for your version of Firefox or Thunderbird, which is more than likely why you are reading this article! Normally, you would click the Install button, but in this case, you want to save the file to disk, so right click on the install (or Add to Firefox / Add to Thunderbird) button, and then click 'Save Link As'. Choose a location on your disk, make a new folder if necessary. The file you download will be named something like better_gmail_2-0.6-fx.xpi. On rare occasions you may find that when using Firefox, you just can't click 'Save Link As' for some reason. Try a different browser, you may have better luck saving the file when the browser itself is not capable of actually installing the addon.
Having saved the addon, you will need to extract one file named install.rdf from it, make a change, and then pack it back into the file. Since the addon is just a zip file containing all the supporting files necessary for the addon, the easiest way to extract files is to rename the original by changing the .xpi extension to .zip, or by simply adding .zip to the end of the file name temporarily. You will need to extract the install.rdf file from the zip file, edit it, and then put it back in again, so if you're not comfortable with these tasks without me describing them in great detail, don't try. Ask somebody else who is comfortable using zip to extract a file and pack it back in again to help you with this process.
Once you have the install.rdf file extracted, open it with your text editor, and look for lines like the ones listed below. Many addons don't have these lines, so they are not checking for specific versions, and you should not see any incompatibility messages.
The part you need to change is the line with the maxVersion setting. As long as I am running Firefox 3.0.1, this addon should work for me, but when I upgrade to 3.1, or 4, it will no longer work. The next step is to change the maxVersion setting to at least the version you are currently running, I usually just change it to 9.0 which means I can run any version that will be released for some time to come. You can actually set the maxVersion to *.* and never have to worry about future Thunderbird updates, but ideally you should also get official add-on updates as they are released.
If your install.rdf looks really weird when you open it, and seems to have just a few lines that look really long, and don't all display on the screen, don't panic. Most likely, the addon programmer has used a Unix or Linux system to create the files, or they have used an editor that does not automatically wrap lines. The Unix or Linux option may be the more likely of the two, and if you don't know what I mean by line termination characters and vi, explaining more would only confuse you even more. Either way, some Windows text editors will know what to do with a non-typical Windows text file, Notepad will not, so if you see just a few long lines, just use Ctrl F, or click Edit, Find, and then type maxVersion. All you need is to find this setting, change it, and save it. Don't worry about the strange file formatting.
After making the change, save the install.rdf file, pack it back into the addon zip archive, and rename it back to it's original name ending in .xpi. The last step is to actually install it, and to do this, procedures are slightly different for Thunderbird versions prior to 7, and for v 7 and later.
For Thunderbird versions prior to v 7, rather than browsing to http://addon.mozilla.org, simply click File, Open File, select your modified .xpi file and click the Install Now button. At this point, unless you made any mistakes or any other problems were detected during installation, your addon is installed and will be ready for use when you restart Firefox. The same should all be true for Thunderbird addons.
For Thunderbird 7 (and presumably later) the process has changed slightly but is still just as easy. Instead of File, Open File and selecting the modified .xpi file, simply click Tools, Add-ons. This will open a new tab. Look for a gear icon just to the left of the Search all add-ons dialog box on the right side of the display. This will open a pop up menu, select Install Add-on From File, browse to the modified file, and continue with the previous instructions.
An even easier way, after editing and repacking the files, you can simply drag and drop the .xpi files using Explorer or any other file manager tool into Thunderbird, and the installation process will start immediately. Just look out for the confirmation window, it may pop open quickly enough that you don't at first notice it, and it may be obscured by your file manager. This drag and drop method works for both Firefox and Thunderbird, in current versions as of December 2011.
If you have other utilities in your toolbox that you are comfortable using, you can make the whole process even easier. If you use a file manager like the freeware Free Commander or shareware Total Commander that has built in support for zip and other archive files, after renaming the .xpi file you can simply double click it which will open it as if it is a folder on disk. Once inside it you will be able to see all the supporting files and folder structures. Total Commander allows automatic repacking of edited files back into a zip file, Free Commander is not quite as flexible. Simply point at the install.rdf, and press whatever the function key (F4 in Free Commander and Total Commander) or click the menu item that opens the selected file in your default text editor. Make the changes, and for Total Commander, save the file, and go back up out of the virtual folder used to display the zip file contents. The modified version of the install.rdf will be automatically packed right back into the zip file for you. For Free Commander, save the file to a different location, e.g. C:\Temp, and then use Free Commander to copy the file back into the virtual archive folder which will repack it in.
As I said, problems are rare, however you don't know everything the programmer did when writing the addon, so monitor everything carefully until you are sure everything is functioning as it should. There may be specific features in different releases of Firefox or Thunderbird being used by the addon programmer which might really make the addon incompatible with a newer release. In general, unless there is a major change, most things should be safe, because addons for example that "mess" with cookies, such as CookieCuller, are simply changing cookie files where the format does not generally change. The real point is, be careful, and keep backups so that you don't have any reason to curse yourself for making the change, and me for telling you how to do it.
Allan Marillier, original article date August 2008
Updated September 2011 for Thunder bird 7 install procedure
Updated December 23rd, 2011 - Thunderbird allows drag and drop of hacked addon files
Updated December 27th, 2011 with a paragraph about Mozilla's Add-on Compatibility Reporter