Nifty Dictionary Bookmarklet

25 July 2003
12:12 AM

I want to share a cool JavaScript bookmarklet I learned about at macosxhints.

For those unfamiliar with the concept, a bookmarklet is like a normal web browser bookmark (or "Favorite"), but it runs a miniature JavaScript program. Before, bookmarks were just placeholders for frequently used locations. Now, they can also be shortcuts for frequently used tasks. This bookmarklet takes any word you have selected on a current web page and defines it on Merriam-Webster's site.

To use it, copy the following text, create a new bookmark/favorite, and paste this where the URL usually goes. Note: below, the code appears on two lines, but you must remove the return for it to work properly. Give the bookmark any name you want. Then, highlight a word and select the bookmark.


javascript:x=escape(getSelection());if(!x)%7Bvoid(x=prompt('Word?',''))
%7D;window.location='http://www.m-w.com/cgi-bin/dictionary?book=Dictionary&va='+x

If you're interested in other uses for bookmarklets, visit this bookmarklets site.

Comments