Enabling Extension Updates

So you’ve learned how to write your own extension. This tutorial will show you how to keep your users up to date with your latest version automatically.
One of the cool things about having an update feature in your extension is the user won’t have to check your homepage all the time to see if there’s a new version available. Firefox will let them know that a new version is available as soon as you update it, thanks to a file called update.rdf.
update.rdf resides on your server’s directory; in my case, it’s here:
http://extensions.roachfiend.com/update.rdf
You can take a look at it if you want. You’ll see that it’s got syntax highlighting and colors on it. This is good. That means that my server is correctly identifying it as an rdf file, and not just some random text file. This is the number one reason why things go awry when you try and set up an update file. There are two ways of remedying this if you run into problems: the first and easiest method is if you have cpanel running on your server. If so, just go to MIME types, and then add a new type as the following:
MIME type: text/xml Extension: rdf
If you don’t have cpanel installed, but you have an Apache server, you can add this to your root directory’s .htaccess file:
AddType text/xml rdf
Ok, now your server should recognize the file we’re going to create. Here’s a sample update.rdf file you can copy and paste, and edit as necessary. In this example we’ll track just one extension, but in my file posted above, you can see that you can keep tabs on a boatload of extensions.
Note: There is no space between Description about=”urn:mozilla:extension: and {b4fb60db…} on lines 5 and 6 below. I had to split them up because it was too long on the web page. Sorry if this is what caused your insanity. Thanks, Karl!
<?xml version="1.0"?>
<r:RDF xmlns:r="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns="http://www.mozilla.org/2004/em-rdf#">
<!-- Foo Widget Extension -->
<r:Description about="urn:mozilla:extension:
{b4fb60db-ac1c-4c10-b0f6-39b0b0f56ea5}">
<updates>
<r:Seq>
<r:li>
<r:Description>
<version>0.1</version>
<targetApplication>
<r:Description>
<id>{ec8030f7-c20a-464f-9b0e-13a3a9e97384}</id>
<minVersion>0.8</minVersion>
<maxVersion>1.9</maxVersion>
<updateLink>http://www.webserver.com/foowidget.xpi</updateLink>
</r:Description>
</targetApplication>
</r:Description>
</r:li>
</r:Seq>
</updates>
<version>0.1</version>
<updateLink>http://www.webserver.com/foowidget.xpi</updateLink>
</r:Description>
</r:RDF>
So you would need to replace the web address and extension path as your own, as well as the first GUID that starts with b4fb… with your extension’s GUID. The second one that begins with ec80… is unique to Firefox, so leave that alone.
You’ll notice two <version> tags- in the past sometimes the mechanism ignored any attributes outside of the <updates> tags, so having two ensured compatibility. To be honest, I don’t know if both are necessary, but it works, so hey, whatever. Put the current version number of your extension in there, so Firefox will have a new version to check against. If the number in here is greater than the user’s current release, then it will prompt them to install the new version.
So, we’ve got the modified update.rdf file on the server. Now we need to tell the extension to call home to see if there’s a newer version. In your install.rdf file, you need this line:
<em:updateURL>http://www.webserver.com/update.rdf</em:updateURL>
That’s it! You can test it out by keeping an old version of an extension installed on your browser (that has the updateURL above in place) and uploading the new version on your server.

March 10th, 2005 at 12:42 am
One thing to keep in mind, for the advanced version of the tutorial, is managing raising maxVersion for old extension versions. If you package version 0.1 of your extension with maxVersion 1.0 of the application, then raise it in update.rdf to 1.1, and then you move on to version 0.2 of your extension, but some well-known and frozen-in-time site is still distributing version 0.1, you have to maintain updates elements for both versions of the extension, since someone trying to install 0.1 has to get the message that the maxVersion has been raised, so they can install 0.1, so that they can then be told to update to 0.2 the very first time they check for updates.
March 10th, 2005 at 8:37 am
That’s one of the reasons that I keep my extensions’ maxVersion at 1.2. Although technically incorrect, it has saved me from updating 9 extensions every few weeks. If the time comes where Firefox 1.2 is out and my extensions aren’t compatibile, I’ll simply change them so they are or delete them.
March 11th, 2005 at 11:55 pm
I’ve done an extension at work and been trying to get update working for some time until I found this page. Before, I was copying the same update as for googlebar and some other extensions, but somehow it didn’t work. I just tried using your rdf file as template and worked! I really don’t understand how works for other extensions and I had to add updates, targetApplication, etc. tags to update.rdf to make it work for my extension. Any ideas? It’s a personal thing now ;-)
March 23rd, 2005 at 5:47 am
In the htaccess file you should in fact have a . before the rdf:
AddType text/xml .rdf
March 24th, 2005 at 12:06 pm
Ihoss, the period makes no difference. When done through cpanel, the htaccess file that is generated doesn’t have one, so if anything, it’s preferred to leave it out.
March 25th, 2005 at 6:16 pm
The period makes no difference. The webserver will just check if what you entered exists at the very “end” of the file.
Example: poop.rdf
rdf
||| =-=-=-Match Found
poop.rdf
.rdf
|||| =-=-=-Match Found
I like things optimized though, so stick without the period, itll speed things up .00001 percent :D
April 2nd, 2005 at 5:25 pm
And also remember to have the mime type for xpi files on your sever as:
AddType application/x-xpinstall .xpiApril 4th, 2005 at 9:14 am
I installed it before I replied. That’s why I wrote that it didn’t make any sense. I don’t know why you’re getting a download error, but it works for me and it works on several different machines that I’ve tried.
April 4th, 2005 at 6:04 pm
Dear Eric, thanks for your two tutorials.
I’m doing an extension for interactive use with webradio http://www.frequence3.fr/ and I just needed YOU to do it. Great job.
April 13th, 2005 at 5:15 am
How do I make an update.rdf file for themes? Does it work the same way as for extensions? Thanks.
April 14th, 2005 at 3:45 am
Tried it, yup it does work the same way for themes. Thanks!
April 19th, 2005 at 7:12 am
[...] Firefox / Mozilla — daryl @ 8:57 am Eric Hamiter’s tutorial on how to enable extension updates is pretty handy. As he points out, in order to mak [...]
April 21st, 2005 at 3:45 pm
I am developing a generic extension. I don’t want to hardcode the updateURL in the install.rdf. How can I do that?
April 24th, 2005 at 2:20 pm
AWESOME! Thanks so much for this and your tutorial on how to write them. It is exactly what I was looking for and helped me a lot. You are a very nice man, Eric ;)
May 11th, 2005 at 9:48 am
Hi! These guys have a online form to generate update.rdf contents.
http://www.gmacker.com/web/content/tutorial/firefox/updatefirefoxext.htm
July 2nd, 2005 at 7:48 pm
[...]How to Create Firefox Extensions
Eric of roachfiend.com has two helpful tutorials up on How to Create Firefox Extensions and Enabling Extension Updates. These’ll come in handy soon. Hint hint (via Gina).
September 10th, 2005 at 11:57 am
I updated the original post to increase the maxVersion number to 1.9 so it’ll work for current Firefox releases and hopefully future-proof your extensions for at least a few months.
December 12th, 2005 at 1:54 pm
Hallo there,
Does anybody know where to find a reference which events are fired at what time?
January 7th, 2006 at 9:19 pm
For the longest time the extension manager would tell me there were “no updates available”. It was because I combined the 5th and 6th lines above into one line, including a space where the newline was–
became
Bad idea. Do NOT put a space after that colon.
Hope I save someone frustration.
January 7th, 2006 at 9:24 pm
Hmm… the stuff inside my “code” blocks is gone. I think the point still comes across, though. I was talking about lines 5 and 6 of Eric’s update.rdf example.
February 11th, 2006 at 3:34 pm
I just had the space after urn:mozilla:extension: problem
I should have read the comments 30 minutes ago!
February 13th, 2006 at 2:20 am
Hello All,
If an extension’s GUID is changed – is it possible to update the versions with the older GUID?
Are there any workarounds for this or is it not possible at all?
Thanks,
March 8th, 2006 at 2:59 am
Nice tutorial!
If there is room for suggestions, consider showing how to create an update.rdf file that has multiple target applications (e.g Firefox, Thunderbird, Flock)
I had to search for an example and found http://divmod.org/trac/browser/trunk/ClickChronicle/extension/update.rdf?rev=3723
March 21st, 2006 at 1:10 pm
Well that just answered the question I just asked in the last article. Sorry, I should have checked here first.
March 23rd, 2006 at 4:16 am
i just have found, that i can’t use id in format “extensionname@organization.tld” as is suggested in the article:
http://developer.mozilla.org/en/docs/Install_Manifests#id
so, urn:mozilla:extension:extensionname@organization.tld leads to inability to find updates.
is there some workaround or rule of using such ids in update.rdf?
thanks.
May 8th, 2006 at 11:51 am
Dear Eric
Currently i am reading your basic tutorial about FF extension and “I am loving It!!”.
You are continously discussing about MIMEType and .htaccess.If i have IIS server,can a link html link of .xpi file won’t install my extension to browser?
2nd question is about your current article.You discussed about updating toolbar and adding
http://www.webserver.com/foowidget.xpi
for auto updation.If you are using beta google toolbar,the xml file they have provide have Url to update the content of extension or say toolbar button itself.Does FF provide some built-in facility for such task?
Thankyou
May 28th, 2006 at 3:53 pm
Good, it works!
June 10th, 2006 at 11:52 am
Thanks to Eric for the tutorial and big thanks to Karl who save my mind with the space problem bettwen line 5 and 6(it take me 30 minutes to decide to read the comments).
June 13th, 2006 at 1:14 pm
I’ve long been a fan of your extensions, and as I’ve lately begun the quest to build my own, I’ve become a fan of your tutorials. Today I am releasing my first “public” extension — thanks to your very helpful tuts. Thank you for putting the time and effort into sharing these with us. On my extensions page on my website, yours is the first developer’s resource I’ve listed, and is certainly most recommended. :)
Thank you for your time and efforts!
September 1st, 2006 at 5:20 am
Hello guys can you please help me?
September 4th, 2006 at 10:49 am
My update.rdf file is hosted on a webserver that requires regular authentication. This means that the update check will fail unless the user happens to have logged in to the webserver lately. Is there anything in the RDF specification that allows you to ask (or get) webserver credentials so firefox can check the update file?
Great tutorial BTW!!
October 22nd, 2006 at 1:30 am
Hi,
i created my auto update rdf file, and added the MIME type, hoverer it does not works, any idea?
here is the link to my update file:
http://68.178.173.234/downloads/localization/update.rdf
the current version in the xpi is 0.1 and in the rdf file 0.3, so the auto update should be triggered, what is wrong?
Thanks.
December 22nd, 2006 at 12:36 am
Try emptying your cache and re-visiting your update.rdf page in your browser.
January 15th, 2007 at 10:23 am
Does anyone know of a fix for what mojo describes above (id=name@domain) — or know for sure whether this is a problem? When I try to find updates for my extension it says no updates were found though my update.rdf is a version higher and everything else appears to comply with the tutorial above. Thanks for any help.
January 15th, 2007 at 11:10 am
Well I spoke too soon. I looked at the update.rdf for some of the extensions I use and noticed they don’t use the brackets {} if not using a GUID. Once I removed the brackets in the update.rdf file the updated version was detected and the update ran fine. Thanks for the tutorial!
May 18th, 2007 at 8:16 am
Thank you for your time and efforts!
July 25th, 2007 at 4:07 pm
Does not work no matter what I tried.
There are different approaches for in the install.rdf file, some just like this:
http://home.arcor.de/dac324/firefox/germanlocale/update.rdf
Is this really necessary?
My update.rdf resides here:
http://home.arcor.de/dac324/firefox/germanlocale/update.rdf
I have version set to 0.0.1 in install.rdf and 0.2 in update.rdf. However, Firefox (3.0a7pre) tells me that it can not find any updates.
July 26th, 2007 at 12:22 pm
I found the culprit: Add-On updates are only allowed for add-on types 2 (extension) and 4 (theme) but not for 8 (locale). So I had to change the add-on type to 2 in order to enable updates.