on bookmarlets.
¶ by Rob FrieselWhile most of the time your Favorites/Bookmarks are significator-enough for the browsing you’re doing (i.e., “let’s go the Slashdot homepage!”) they don’t always pack the punch you need. Maybe they get you where you need to go but they don’t log you in. Or they get you to some page but then you need to put in a date-sensitive search query, etc. etc. So much time wasted typing usernames and passwords or clicking radio buttons or…
You get the picture.
Wikipedia has bookmarklets defined as (current as of 12/19/2004 approx. 09:39 Eastern):
…a small JavaScript program that can be stored as a URL within a bookmark in most popular web browsers…
Which is pretty slick.
When I was first exposed to this concept about a year or so ago, I was only marginally impressed. You could wrap a URL inside of something like javascript:void(window.open('...')); so that your bookmarks opened themselves in a new window. BFD… Only slightly more impressive was using similar statements to auto-populate the fields of a form. (Say, the username/password fields of something you logged into 20 times a day.) What didn’t dawn on me until quite recently (past 3-6 months) was that with the appropriate character escaping, you could do some pretty wild and complicated stuff with this. Blogger uses this to drive the BlogThis! feature, for example. You can create a Date object on the fly to populate a date in the query component of a URL. Add some basic arithmetic to that and you can have it (for example) show you a series of articles or other items from the past week. Making all the right assumptions, of course…
Leave a Reply