Emergic: Rajesh Jain's Blog

Emergic: Rajesh Jain's Blog header image 2

Greasemonkey as a Lightweight Intermediary

April 19th, 2005 · No Comments

Simon Willison writes:

The latest release of the swiss army knife of Firefox extensions adds support for cross-domain XMLHttpRequest calls from greasemonkey scripts. What that means is that you can create a user script (a short JavaScript that will be executed whenever your browser loads specific pages) that can then pull extra data in from another server.

I’m using this for my final year project, a decentralised web annotation system that lets you annotate pages, storing your annotations locally and then sharing your public annotations as a feed (similar to the way RSS aggregators work). The trick there is to run a local web server on some port, then have the Greasemonkey user script (eventually a full extension) communicate with that local server to store and retrieve data. I’m using Ruby on Rails’ built in WEBrick server to prototype the service, and it’s working a treat.

This architecture could be easily adapted to add private bookmarks to del.icio.us – or to add any number of cool features to any number of other sites. Here’s another example: Google’s Desktop Search integrates results from your local drive with the search results page on Google. Using greasemonkey and a local web server tied in to OS X Tiger’s Spotlight indexer, you could add this functionality to any search site you wanted to. Just be sure to lock down the web server to only serve requests from localhost, to avoid sharing search results for your data with anyone on the network who can see your machine.

Tags: Software

0 responses so far ↓

  • There are no comments yet...Kick things off by filling out the form below.

Leave a Comment