Related Internal Topics:
XUL
|
Chrome
Related External Links:
Theory
|
Example
|
More Theory
|
Mozilla DOM Window API
|
Mozilla XUL doco
|
XUL info/tutorial
.XPI Packaging
Extensions are packaged in a .xpi file which is in a zip format. This file contains:
- install.js
- install.rdf
- chrome
install.js
This is for pre 0.9 firefox compatibility. An example follows, simply replace with suitable attributes for the extension you are writing:
// --- Editable items begin ---
extFullName: 'Hello, world!', // The name displayed to the user
extShortName: 'helloworld', // The leafname of the JAR file
extVersion: '0.1',
extAuthor: 'Eric Hamiter',
extLocaleNames: null, // e.g. ['en-US', 'en-GB']
extSkinNames: null, // e.g. ['classic', 'modern']
extPostInstallMessage: 'Success! Please restart your browser to finish the
installation.'
// Set to null for no post-install message
// --- Editable items end ---
install.rdf
This holds all the install information for firefox 0.9+.
<?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>{9AA46F4F-4DC7-4c06-97AF-5035170633FE}</em:id>
<em:name>Hello, world!</em:name>
<em:version>0.1</em:version>
<em:description>Displays an alert message via right-click
or Tools menu.</em:description>
<em:creator>Eric Hamiter</em:creator>
<em:homepageURL>
http://extensions.roachfiend.com</em:homepageURL>
<em:iconURL>chrome://helloworld/skin/helloworld.png</em:iconURL>
<em:aboutURL>chrome://helloworld/content/about.xul</em:aboutURL>
<em:file>
<Description about="urn:mozilla:extension:file:helloworld.jar">
<em:package>content/helloworld/</em:package>
<em:skin>skin/classic/helloworld/</em:skin>
</Description>
</em:file> <em:targetApplication>
<Description>
<em:id>{ec8030f7-c20a-464f-9b0e-13a3a9e97384}</em:id>
<em:minVersion>0.7</em:minVersion>
<em:maxVersion>1.9</em:maxVersion>
</Description>
</em:targetApplication> </Description></RDF>
The <em:id> tag gives this extension a unique id different to make it unqiue among other extensions. Generate this with a GUID tool such as
guidgen .
Name, version, description, creator, and homepageURL are all self-explanatory. The iconURL and aboutURL are what shows up if someone right-clicks your extension and chooses ?About Extension??. You can leave these blank, it?s not mandatory, but it?s nice to have a little flash every now and then.
Underneath file, this is standard stuff. Just replace all instances of ?helloworld? with your extension name. This is where the installation will try and find your files and folders. If you have any icons, you?ll include the skin folder. Again, it?s not mandatory.
Target application is what you?re gearing this for. The ec8030f7? is unique to Firefox, so leave that alone. The minversion and maxversion is what versions of Firefox it will be compatible with.
chrome directory
The chrome directory contains a .jar file which contains all the required elements. See
Chrome for more info.