Creating an update site for your CCK
One of the questions I get asked the most is what is the update URL and how does it work. Many people point the update URL to the location of the actual XPI, not realizing that what the update URL is supposed to be is an RDF file that Firefox reads to get information about available updates. This page will hopefully explain how to create your own CCK update site.
For our example, let's assume we had previously released a CCK for IBM with a version of 0.1 that only supported Firefox 1.5. Now we have created version 0.2 and we want to make the update available. To do this, we need to create an RDF file that describes the updates. Here's what that file will look like:
<RDF:RDF xmlns:RDF="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:em="http://www.mozilla.org/2004/em-rdf#"> <RDF:Description about="urn:mozilla:extension:IBM-cck@firefox-extensions.ibm.com"> <em:updates> <RDF:Seq> <RDF:li resource="urn:mozilla:extension:IBM-cck@firefox-extensions.ibm.com:0.1"/> <RDF:li resource="urn:mozilla:extension:IBM-cck@firefox-extensions.ibm.com:0.2"/> </RDF:Seq> </em:updates> </RDF:Description> <RDF:Description about="urn:mozilla:extension:IBM-cck@firefox-extensions.ibm.com:0.1"> <em:version>0.1</em:version> <em:targetApplication> <Description> <em:id>{ec8030f7-c20a-464f-9b0e-13a3a9e97384}</em:id> <em:minVersion>1.0+</em:minVersion> <em:maxVersion>1.5</em:maxVersion> <em:updateLink>http://firefox.ibm.com/ibmcck/0.1/ibmcck.xpi</em:updateLink> </Description> </em:targetApplication> </RDF:Description> <RDF:Description about="urn:mozilla:extension:IBM-cck@firefox-extensions.ibm.com:0.2"> <em:version>0.2</em:version> <em:targetApplication> <Description> <em:id>{ec8030f7-c20a-464f-9b0e-13a3a9e97384}</em:id> <em:minVersion>1.0+</em:minVersion> <em:maxVersion>2.0.0.*</em:maxVersion> <em:updateLink>http://firefox.ibm.com/ibmcck/0.2/ibmcck.xpi</em:updateLink> </Description> </em:targetApplication> </RDF:Description> </RDF:RDF> |
Now let's go over each section to see what you need to change for your CCK.
Top level description
<RDF:Description about="urn:mozilla:extension:IBM-cck@firefox-extensions.ibm.com">This needs to be changed to the extension ID you used for your CCK.
List of available versions
<RDF:Seq> <RDF:li resource="urn:mozilla:extension:IBM-cck@firefox-extensions.ibm.com:0.1"/> <RDF:li resource="urn:mozilla:extension:IBM-cck@firefox-extensions.ibm.com:0.2"/> </RDF:Seq>These lines are used to identify the versions of your software that are available. Again, change extension ID as well as the version. You should have a line here for each version of your sofware. As you produce updates, more lines will get added here.
Description of each version
<RDF:Description about="urn:mozilla:extension:IBM-cck@firefox-extensions.ibm.com:0.2"> <em:version>0.2</em:version> <em:targetApplication> <Description> <em:id>{ec8030f7-c20a-464f-9b0e-13a3a9e97384}</em:id> <em:minVersion>1.0+</em:minVersion> <em:maxVersion>2.0.0.*</em:maxVersion> <em:updateLink>http://firefox.ibm.com/ibmcck/0.1/ibmcck.xpi</em:updateLink> </Description> </em:targetApplication> </RDF:Description>This is the description of the actual update. You will have one of these for each item you referenced in the above list of versions. Change the description to have your extension ID and your version. Change em:version to be your version as well. The targetApplication we've specified is for Firefox 2.0 including any security updates. You can see that in our case, version 0.1 did not support Firefox 2.0 but version 0.2 does. The most important thing in the description is the actual location to the file we are providing for the update.