Ping ([info]zestyping) wrote,
@ 2005-11-27 01:47:00
Previous Entry  Add to memories!  Tell a Friend!  Next Entry
Entry tags:code

How to get started developing an extension for Firefox 1.0 or 1.5.
I'm trying to write a Firefox extension, which i'm discovering means i have to create zillions of fiddly little files full of XML crap. There are a few good tutorials out there, like this one at borngeek.com, though they take some patience to work through. It took me a while to finally get something working. (The tutorial says "Creating a Firefox extension is easy," and other websites out there seem to all insist it isn't too hard, but it all seems awfully complicated to me. Writing all this boilerplate metadata makes me feel like i'm going through some sort of arcane hazing ritual for a fraternity invented by the bastard children of Tim Bray and Jamie Zawinski.)

So i hope this saves someone out there some time: helloworld-xpi.zip. This gives you a minimal framework to start from, with an example of a menu command and a toolbar button, and all the necessary files to make it work with both Firefox 1.0 and Firefox 1.5. There's a locale included as a starting point for internationalization. There's also a Makefile so you can just type "make" and it will pack everything into a single .xpi file for you. If you're using Firefox 1.5 on a Mac, "make link" will set up a link so that you can edit and see your changes without having to repackage and reinstall your extension.



(Post a new comment)


[info]fanlain
2005-11-27 04:12 pm UTC (link)
what extension are you trying to build? this sounds interesting; i might tinker with it later.

(Reply to this)(Thread)

ISBN
r6
2005-11-27 05:52 pm UTC (link)
I hope Ping is making a plug-in to resolve ISBN URNs.

(Reply to this)(Parent)(Thread)

Re: ISBN
[info]zestyping
2005-11-28 12:39 am UTC (link)
Aha! Someone has already written a plug-in to handle URNs of various kinds, including ISBNs. I just installed it and the URN link in your entry works properly.

(Reply to this)(Parent)(Thread)

Re: ISBN
r6
2005-11-28 06:45 pm UTC (link)
Nice. It even resolve my RFC URNs.

(Reply to this)(Parent)

share the luv...
[info]josephhall
2005-11-27 05:59 pm UTC (link)
It would be great to get this package added to one of the tutorials that frustrated you so that others in the future are not as frustrated. One tactic that I regularly employ is to write an entry (blog or journal) that's specifically tailored for Googlers like this.

(Reply to this)


[info]jerub
2005-11-27 08:14 pm UTC (link)
The greasemonkey extension is your friend. Greasemonkey scripts are tiny, don't require reloading firefox, can install with right-click "Install user script", and can edit Greasemonkey->Manage User Scripts->Select Script->Edit... in the editor of your choice (I use vim).

That said, thanks heaps for the helloworld-xpi, I never managed to get an xpi working before, too much hassle.

(Reply to this)(Thread)


[info]zestyping
2005-11-28 12:25 am UTC (link)
Can Greasemonkey let you add bits to the browser UI? I thought it was only for altering the display of webpage content.

It seems like just the thing to fulfill r6's wish for an ISBN resolver.

Glad this bit of hacking was useful for someone... makes it feel less like a waste of time (this way, the Mozilla developers are wasting just my time instead of wasting both my time and your time).

(Reply to this)(Parent)(Thread)


[info]idealisms
2005-11-28 07:24 am UTC (link)
GM has a command (GM_registerMenuCommand) for adding menu items to the Tools menu. Not so useful if you want to significantly modify the browser chrome.

Getting started with extension development has a working extension that I normally start with. The downside is that it's only for FF1.5 (yay, less RDF files) which is almost out officially. I think Nov 29th is the planned release date.

(Reply to this)(Parent)


Create an Account
Forgot your login?
Login w/ OpenID
English • Español • Deutsch • Русский…