[ start | index | login ]
start > Development > Firefox Extensions

Firefox Extensions

Created by mpecher. Last edited by mpecher, 2 years and 299 days ago. Viewed 641 times. #10
[diff] [history] [edit] [rdf]
labels

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.
no comments | post comment

Menu:
Java & J2EE
Development
Books

Help:
Help FAQ
Formatting


< January 2009 >
SunMonTueWedThuFriSat
123
45678910
11121314151617
18192021222324
25262728293031


Logged in Users: (0)
… and 13 Guests.



Disclaimer: Views and opinions are that of the individual author, and not that of Marand Custom Solutions. This site is an open forum for technical content, and the company accepts no liability for any content or view expressed.