Writing Bookmarklets
Warning: Undefined property: linknotes::$are_links in /var/www/vhosts/basil/kbsite/blog/wp-content/plugins/linknotes.php on line 73
I recently installed a WordPress plugin that lets me look at my stats, and “writing bookmarklets” is pretty high on the list of search strings. In fact, I come up on the first page of a Google search. Crazy. “Better Living Through Bookmarklets” has some good information to get someone started. “Tips for Writing Bookmarklets” has some really good tips for writing bookmarklets once you’ve gotten a feel for it.
I highly recommend hacking the bookmarklets of others to see what makes them tick. Good targets are Jesse Ruderman’s bookmarklets and Tim Powell’s.
I saw one article in my Googling that advised using “ugly variable names,” ie, random alphanumeric strings, to avoid namespace interference. Ick. Encapsulate your bookmarklet in a function to restrict the scope of your variables. This is also a helpful trick to dispense with void()
.