Tuesday, August 16, 2005

Firefox Shortcut URL as Command Line for the Web

I have been doing some work on Firefox extensions. Mozilla/Firefox is a really interesting world, it is extremely flexible, you can make it transform the web the way you want.

Recently, someone started YubNub, the "command line for the web", a very simple idea, but useful. This is a bit similar to the Firefox Search Bar, except more powerful, and quicker to use. Mozilla developers actually had that idea a long time ago (around 2000), it is called shortcut url. Basically to any bookmark, you can add a shortcut, you then just have to type that shortcut (let say g for google.com) in the address bar to go to the address pointed by the shortcut. This shortcut accepts 1 parameter (represented by %s in the URL), so you can do "g chasethedevil" to search google for "chasethedevil" if you set up your shortcut properly. Firefox can build this dynamic URL automatically for you if in an input box, you right click and choose "Add a keyword for this search".

Now we have seen the Firefox address bar can be used to quickly perform a search on a selected website. But this can be much more powerful. As this page suggests, you can associate a bookmarklet with a shortcut, you can execute whatever javascript you wish. One very simple example is:
javascript:void(location.href=
'http://web.archive.org/web/*dc_/'+location.href)
. This shows how you can use the address bar in a very flexible manner. It would be easy to support a multiple parameters search using a bookmarklet. There is a whole list of commands very similar to yubnub ones in addition to those on the previously mentioned link.

I first thought about writing a simple extension to have my command line in Firefox (for example by extending the getShortcutOnURI function), but after some information gathering, I discovered it was already possible. Firefox is truly amazing. It is a bit of a shame that this functionality is not a bit better exposed to the user.

tags:

No comments :

Post a Comment