« In single-source publishing, what do you call the source? | Main | Charlie Rose interviews Charlie Rose »

My favorite bookmarklets

Bookmarklets to search a website, navigate it, and see what links to it.

The recent lifehacker article Ten Must-Have Bookmarklets reminded me that I've developed a few handy ones myself. A bookmarklet ("bookmark" + "applet") is a little bit of Javascript embedded in a link. They usually take some information about the page you're looking at and do something useful with it. For example, if you highlight some text on this page and click this demo it displays the highlighted text in a message box. This particular example is not very useful, but it demonstrates how a bookmarklet can grab information from the displayed web page and do something with it. The following shows what's really in the link:

<a href="javascript:alert(document.getSelection())">this demo</a>

Bookmarklets more complex than this one may define and call functions, but they're still all packed into a a element's href attribute. The lifehacker article has one that builds on this use of the getSelection() method by looking up the selected text in an acronym dictionary.

Running bookmarklets on the page that contains them is rarely interesting, but when you keep these bookmarklets in your bookmarks menu (or, more likely, on your bookmarks toolbar), you can run them against anything, which is when they get valuable. You could drag that "this demo" link to your bookmarks toolbar and then highlight text on any web page, click that link, and see the highlighted text displayed in a message box, but you'd be better off dragging the more useful ones below to your toolbar:

  • site's homepage goes right to a particular site's homepage—for example, to http://www.snee.com from this page.

  • search site lets you search the website of the displayed page with a minimum of keystrokes. Click it to display a search form with one field (for example, this form if you were looking at the lifehacker article), fill out that field with a string to search for, click "Go," and Google searches that site for you.

  • cd .. goes to the parent directory of the displayed page's directory.

  • backlink tells Google to list pages that link to the displayed page.

Other bookmarklets I use include post to del.icio.us and some of the RDFa bookmarklets that I mentioned recently. I also learned from the lifehacker article about Jesse's Bookmarklets Site, which has many great ones. I was pleased to see (after an admittedly quick scan) that only my backlink bookmarklet above had an equivalent there—it made me feel like my others where somewhat original. I'm especially proud of the "search site" one, which is like the "site's homepage" one with a few extra steps thrown in. I use these two every day; for example, a web search sends me to some page, I wonder "who are these guys?" and I click site's homepage on my toolbar. Or, I get frustrated trying to find something on a site that doesn't offer a Search feature, and I just use my own: search site.