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.
0.1 {ec8030f7-c20a-464f-9b0e-13a3a9e97384} 0.8 1.9 http://www.webserver.com/f… 0.1 http://www.webserver.com/f…
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 tags- in the past sometimes the mechanism ignored any attributes outside of the 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:
http://www.webserver.com/update.rdf
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.