Tag Archives: javascript

A dictionary bookmarklet (or a search bookmarklet for that matter)

So I was bored and wanted to test some of my javascript knowledge, I wrote a simple bookmarklet for searching dictionary definitions and felt like sharing. I’m a javascript noob, so it’s dead simple and is one of the most basic bookmarklets you can imagine. 🙂

I had trouble putting it as a link in wordpress, so go to this link and copy-paste the code as a bookmark.

The script first checks if you have highlighted a word in the current page and, if there is, searches for that word. Otherwise, it shows a pop up where you can enter a word to search.

This searches the Urban Dictionary, but you can change it to search any site you want by simply replacing the URL. Some examples are:

Google: http://www.google.lk/search?q=

Twitter: http://twitter.com/search?q=

Wikipedia: http://en.wikipedia.org/wiki/Special:Search?search=

Have fun!