Bookmarklets - Add macros to your web browser for free.
What is a bookmarklet?
Apart from being another appalling neologism, a bookmarklet is a clever and simple way of using Javascript to add macro functionality to your web browser.
Quite simply, bookmarklets are mini javascript programs that you can have tucked away in your bookmarks/favorites list or on the personal toolbar of your browser to provide you with extra handy functions. Bookmarklets can do pretty much anything that an ordinary javascript can do, except they are not tied to a specific page - you can use them anywhere. Useful bookmarklets can do things like resize and position your browser window, present a list of all hyperlinks or email addresses on a page, or duplicate your browser window.
How do they work?
Hyperlinks commonly use the hypertext transfer protocol (http), indicated by the http:// at the start of the url. (Others include file transfer protocol, gopher, usnet and mailto.) There is another pseudo-protocol for javascript (javascript://) that allows javascripts to be included in normal hyperlink locations, starting a javascript when such a link is clicked.
Any hyperlink can be added to your bookmarks list or personal toolbar including hyperlinks to the javascript pseudo-protocol. Authors of bookmarklets exploit this feature by writing self-contained utility programs embedded in a javascript:// link. And the clever thing about them is that, once you have them in your bookmarks list, they act on the page that you are viewing. So you can add the javascript functionality that you want to any page you visit.
How do you write your own?
Simple - don’t. There are a number of web sites that provide free, debugged bookmarklets for you to use, see www.bookmarklets.com or just input “bookmarklet” into your favourite search engine. Also try the bookmarklet builder and bookmarklets at webreference.
Once you’ve found some bookmarklet scripts that you like, you can adjust them to suit your purpose. There are also one or two interactive helper tools for writing bookmarklets too.
First published: PC Update April 2002 (online version updated)