How To Create a Quick Minimal Firefox Extension?
Asked Answered
T

7

19

What the minimum basic setup required to begin developing a Firefox extension?

Tuckie answered 8/11, 2008 at 11:35 Comment(3)
if you want to answer yourself, post an answer instead of putting it all up in the question body.Buller
+1 to ask the question in the question and then post your answer separately.Afflux
I thought you meant Quick Basic, the programming language. :)Syllabize
C
14

Step 1: Use the Add-on Builder to generate all the necessary files.

Step 2: Extract the downloaded files into your development area.

Step 3: Create a text file in your profile's extensions folder named according to the em:id in the downloaded install.rdf file, put the full path to your extracted files in it then restart Firefox (delete the text file to uninstall if necesary).

Constance answered 21/12, 2008 at 20:53 Comment(1)
as of 2011, this link is now dead, says service is disabled but the tools at addons.mozilla.org/en-US/developers/tools/builder are recommended.Tortious
T
20

Precaution: In order to prevent messing with your default Firefox experience, try the tip below on a newly created disposable test account.

Step 1: Create a new Firefox profile. For this you need to invoke the Profile Manager via command line option:

firefox.exe -profilemanager

Click on the 'Create Profile' button of the Profile Manager, which will invoke a wizard. Give the profile a name. Use the 'Choose Folder' button and save the profile in a appropriately named folder. This folder is where we are going to create our quick and dirty Firefox extension.

Step 2: Change directory to 'extensions' folder within the profile folder created in Step 1. Now we need to give the Firefox extension a globally unique name. Email-like names are good enough for that. For example, [email protected] will be good enough name for the extension. Under the 'extensions' folder, create a folder with its name as the just chosen unique name.

Step 3: Create files chrome.manifest and install.rdf. You can copy paste the sample here with the names, description altered appropriately.

chrome.manifest:

content 1mffext chrome/

and install.rdf:

<?xml version="1.0"?>
<RDF:RDF xmlns:em="http://www.mozilla.org/2004/em-rdf#"
         xmlns:NC="http://home.netscape.com/NC-rdf#"
         xmlns:RDF="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
  <RDF:Description RDF:about="rdf:#$Fsv+Z3"
                   em:id="{ec8030f7-c20a-464f-9b0e-13a3a9e97384}"
                   em:minVersion="2.0"
                   em:maxVersion="3.0.*" />
  <RDF:Description RDF:about="urn:mozilla:install-manifest"
                   em:id="[email protected]"
                   em:type="2"
                   em:name="[email protected]"
                   em:version="0.0.1"
                   em:description="One Minute FireFox extension"
                   em:creator="labsji "
                   em:homepageURL="http://labsji.wordpress.com">
    <em:contributor>Venkat83</em:contributor>
    <em:targetApplication RDF:resource="rdf:#$Fsv+Z3"/>
  </RDF:Description>

Step 4 Create folder called chrome and create a text file called test.txt within the folder. files in the folder will be accessible via chrome url like chrome://1mffext/content/test.txt

Now the bare minimum extension is ready. Regular html/javascript files can be used to create the functionality desired.

Testing the Extension: Invoke firefox to use the profile created above.

firefox.exe -profile <path of the newly created profile> -no-remote

I have created a googlecode project to share the resultant code created following the steps above. The code along with run scripts are available at Just a Minute Firefox Extension

Sim-OnDemand- personal virtual world as a Service's launcher application is an example of an application packaged and distributed using this method.

Tuckie answered 8/11, 2008 at 11:47 Comment(0)
C
14

Step 1: Use the Add-on Builder to generate all the necessary files.

Step 2: Extract the downloaded files into your development area.

Step 3: Create a text file in your profile's extensions folder named according to the em:id in the downloaded install.rdf file, put the full path to your extracted files in it then restart Firefox (delete the text file to uninstall if necesary).

Constance answered 21/12, 2008 at 20:53 Comment(1)
as of 2011, this link is now dead, says service is disabled but the tools at addons.mozilla.org/en-US/developers/tools/builder are recommended.Tortious
U
1

To start another instance of firefox with a different profile you can use the following command:

firefox -P My_test_profile -no-remote

This way you can have 2 different firefox running and use one for testing extensions without messing with the one you use regularly.

Uropod answered 8/11, 2008 at 12:24 Comment(0)
N
0

Interesting information.
Now to answer the question, I would say: create a Greasemonkey script (or Chickenfoot, or iMacros, etc.).
Might be more limited (in changing FF UI for example) but good for most needs.

Naarah answered 8/11, 2008 at 12:44 Comment(0)
T
0

Here are the reasons why someone would want to create a minimal firefox extension.

  1. When you wish to create a local computer( disk) resident browser based application, interacting with the file system for reading and writing is possible if the application is structured as an extension.
  2. Quick prototyping without worrying about XmlHttpRequest cross domain issues. When you run as plain application, user is hassled with a pop-up whenever XmlHttpRequest is attempted.
  3. Many a times, installing an extension causes a lot of angst in terms of 'Will this mess up with my other customizations?'. A work in progress extension can be distributed along with a profile so that the user can preview, test it. Without worrying about messing with the default firefox browsing experience.
Tuckie answered 8/11, 2008 at 15:40 Comment(0)
D
0

The Add-On SDK makes simple add-on development easier. https://developer.mozilla.org/en-US/Add-ons/SDK

Steps for Mac/Linux:

Durman answered 23/7, 2014 at 1:3 Comment(0)
E
-1

I suggest testing on the Portable edition of Firefox.

Entrepreneur answered 8/11, 2008 at 11:50 Comment(2)
It does not run in parallel with a normal Firefox, instead create an alternate profile to be able to run and restart a Firefox while keeping your regular Firefox open.Dullard
But you can close the regular Firefox, and play with a portable one.Entrepreneur

© 2022 - 2024 — McMap. All rights reserved.