Friday, January 14, 2011

Extract Firefox Addon Source Code

This instruct table will show you how to extract the source code from any Firefox addon. It requires nothing more than a ZIP extraction utility and a text editor if you choose to edit and repack the source.

NOTE : Some addons require a license agreement to be accepted beforehand. In that case, the XPI file can be saved from the button on the license acceptance page, and not the addon page itself.

Instead of just clicking the button and having Firefox take over, right click and choose "Save Link As...". Once the file transfer is done, you will have the addon package right on your computer.

step 2Extracting XPI File
Now that the file is on your computer, open up your personal ZIP extraction utility, and point it to the XPI file. In reality, XPI files are merely ZIP files renamed, so you can go ahead and extract the contents to a folder someplace. Common files outputted are...

install.js
install.rdf
/chrome/
/defaults/

With these files present, you're ready to move on.


step 3Extracting the Main JAR Code
Most of the core addon code is present in a JAR file found in the /chrome/ directory. You'll find that just as XPI is a rename of ZIP, so is JAR (but to a lesser extent). Using the same extraction utility, you should be able to extract the main addon files from the JAR.


step 4That's It!
What you have now are most of the raw source files from the addon. You can modify them as you wish, and repackage them with the modifications. Opening XPI files in Firefox will install them for you.

Always respect an authors work, and make sure they allow you to use their code. Don't just take a popular addon, change the credits, and rehost it. That is just simply stealing.




No comments:

Post a Comment