Ihoss Extension: Update tutorial

Update Extensions Tutorial

How do I keep my extension up to date? - 11/11-2004

Keeping your extension up-to-date can be very important. If you find a bug in your extension then you want everyone to update, as to avoide law suits and such. So, how do you tell everyone who uses the extension they need to update?

Mozilla Update

One of the great things with Firefox (and Thunderbird) is that they can automaticaly check for updates in the extensions. All you have to do is put a file on your server and another line in your install file. Make a new file for your server that you call 'update.rdf'. In this file you add all the extensions you have in a special formated way.

update.rdf

<?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#">

<!-- PHPMyDesktop -->
<r:Description about="urn:mozilla:extension:{xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx}"><!-- GUID of your extension -->
	<updates> <!-- Everything in the update node is for Firefox v0.10 and newer -->
		<r:Seq>
			<r:li>
				<r:Description>
					<version>VERSION</version><!-- latest version of your extension -->

					<targetApplication>
						<r:Description>
							<id>{ec8030f7-c20a-464f-9b0e-13a3a9e97384}</id><!-- This is the GUID for Firefox -->
							<minVersion>Min</minVersion><!-- Minimum version of Firefox your extension works on -->
							<maxVersion>Max</maxVersion><!-- Maximum version of Firefox your extension works on -->
							<updateLink>URL</updateLink><!-- URL of your extension -->
						</r:Description>

					</targetApplication>
				</r:Description>
			</r:li>
		</r:Seq>
	</updates>
	<!-- The 2 nodes below are for firefox 0.9 and older -->
	<version>VERSION</version><!-- latest version of your extension -->
	<updateLink>URL</updateLink><!-- URL of your extension -->

</r:Description>
</r:RDF>

What you need to change there is:
GUID is the unique id of your extensions. It should be the same as in the install file.
Version is the newest version number. If this is bigger than the one in use then it will update.
Min and Max version is the Firefox/Thunderbird versions it works on. You should test to be absolutely sure!
URL is the url of the new extension file
This is all you have to put in your update.rdf file. If you want updates for more than 1 file then you should copy everything inside the description tags and just change the information in red. Click here to see my version.

.htaccess

AddType text/xml .rdf

That is all you have to add to it. If you want your visitors to install xpi files too, then you should put AddType application/x-xpinstall .xpi on another line in the file. Upload this file to the same directory as the upload.rdf file.

install.rdf

<?xml version="1.0"?>
<RDF xmlns="http://www.w3.org/1999/02/22-rdf-syntax-ns#" 
	xmlns:em="http://www.mozilla.org/2004/em-rdf#">

	<Description about="urn:mozilla:install-manifest">

		<em:id>{xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx}</em:id>

		<em:name>Extensions Name</em:name>

		<em:version>1.4</em:version>

		<em:description>Enter some fancy description</em:description>

		<em:creator>Your name here</em:creator>

		<em:homepageURL>http://www.yoursite.com</em:homepageURL>

		<em:aboutURL>chrome://extension/content/about.xul</em:aboutURL>

		<em:optionsURL>chrome://extension/content/update.xul</em:optionsURL>

		<em:iconURL>chrome://exstension/skin/icon.gif</em:iconURL>

		<em:updateURL>http://www.yoursite.com/update.rdf</em:updateURL>

		<em:file>
			<Description about="urn:mozilla:extension:file:extension.jar">
				<em:package>content/extension/</em:package>
				<em:skin>skin/classic/extension/</em:skin>
			</Description>
		</em:file>

		<!-- Firefox -->
		<em:targetApplication>
			<Description>
				<em:id>{ec8030f7-c20a-464f-9b0e-13a3a9e97384}</em:id>
				<em:minVersion>0.9</em:minVersion>
				<em:maxVersion>1.0</em:maxVersion>
			</Description>
		</em:targetApplication>
	</Description>
</RDF>

Add the red part to your install file. Since all you add is the url of the update file, you can use this in all your extensions without any modifications.

Not working?

Ok, so you have added everything and it still does not work?

Finaly

That's it. Add the code where it is needed and test your extension by going to tools>options>advanced>update now. If you want to download the tutorial file and the files I have used, click here. If you have problems then you can have a look at my version here. If you have any questions or ideas send me a mail and I will gladly help you.
Ihoss - Feb/2005