Tuesday, August 1st, 2006

BJAX with Greasemonkey in Firefox and IE

Category: Examples, Firefox, IE

On the heels of my post about BJAX (Browser Extensions plus AJAX), I received a flood of requests asking for an example of how to build such an extension. In response, I’ve put together a Greasemonkey script that demonstrates how to add a simple Ajax widget to a third party web page. The example isn’t particularly useful — a translucent box that floats over the google search page and displays the current weather, updated every minute, in downtown Chicago — but it does illustrate the basics of using GM_xmlhttpRequest as well as the pitfalls of writing Javascript that executes in the Greasemonkey sandbox. An article discussing an updated version that adds support for IE (using the Turnabout extension) and the ability to toggle the size of the widget can be found here.


If you want to do any serious development in this environment, of course, you’ll want to port an Ajax framework across to use GM_xmlhttpRequest instead of XMLHttpRequest, and obey the other restrictions of the Greasemonkey sandbox.

Posted by Dietrich Kappe at 9:07 am

3.9 rating from 24 votes


Comments feed TrackBack URI

Chickenfoot looks like an interesteing alternative to Greasemonkey.

Comment by Benji York — August 1, 2006

Hijacking Google with a Dilbert browser felt more, uhm, useful. ;-)

Comment by Johan Sundström — August 1, 2006

If anyone gets Chickenfoot to work, I’m very interested.

Comment by Jeremy Dunck — August 1, 2006

Leave a comment

You must be logged in to post a comment.