Monday, March 06, 2006

Firefox extension development

As some of you might know, while Adam's trying to make some sense of Hibernate for our Duckstein project, I've started playing around with a side project that happens to be a Firefox extension.

Much to my surprise, the experience so far has been quite enjoyable. Documentation is quite good - a quick tutorial on how to set up a Firefox extension for development, the excellent XUL tutorials from XULPlanet, and I had a simple tic-tac-toe extension working in under two hours. Most of those two hours, as usual, were spent on silly mistakes - and a lot of it could've been avoided if I remembered to use the error console earlier (or if I knew JavaScript properly in the first place).

It seems pretty simple to modify any pages Firefox loads before they're displayed. The fun part of the extension, however, is to interact with pages that are updated dynamically after they're loaded (like, maybe, by XMLHttpRequest, hmm?) This has proved to be somewhat more difficult. I can think of two general approaches... one is to set up an event listener that notifies the extension whenever an AJAX request is sent/received or when the page is modified... the other is to "simply" add my own javascript code to the existing JS code on the page that handles the requests. The first solution seems (in theory) simpler, while the second seems more elegant... I'm not sure which one would be more robust (e.g. resistant to changes made to the site). So far the first solution has been a dead end, however... it seems that it should be enough to add a DOMSubtreeModified listener to the element I'm interested in watching - but I can't even figure out if Firefox supports this listener.

I've also come across a few pretty cool extensions. The first is Firebug (home page), an excellent error/debug console for Firefox that also supports XMLHttpRequests - whenever I'll work on an AJAX project this will be invaluable, and the perfect complement to the also-excellent Web Developer extension which I've been using for a while already. Another is Customize Google - should be self-explanatory. Looking at the source code for these two should help me figure out how to get my extension working, as well.

The third neat extension is Firefoxit - a sort of desktop-inside-Firefox that can hold widgets. Fun stuff.
expand post

6 Comments:

Anonymous <a href="http://users2.titanichost.com/tereritoa1/index26.html">free videoclip sex</a> said...

Nice Article.

12:39 AM  
Anonymous <a href="http://users2.titanichost.com/mezers/index30.html">brutal hardcore sex</a> said...

Please write anything else!

4:42 AM  
Anonymous <a href="http://users2.titanichost.com/hegory/index4.html">beastiality girls with horses animal porn</a> said...

All generalizations are false, including this one.

10:35 AM  
Anonymous <a href="http://users2.titanichost.com/sidspros/index26.html">korean hotties sex</a> said...

A flashlight is a case for holding dead batteries.

11:06 AM  
Anonymous <a href="http://users2.titanichost.com/MarcellaDurant/index6.html">18 xxx sex</a> said...

The gene pool could use a little chlorine.

12:34 PM  
Anonymous <a href="http://phentermine.43i.net/761-061107.html">phentermine in stock no prescription</a> said...

Friends help you move. Real friends help you move bodies.

2:52 PM  

Post a Comment

Links to this post:

Create a Link

<< Home