Bookmark Code Snippets

I’ve recently written two articles that depend on a bookmark. I figured it would be easier to use this article as a reference when I conclude future articles where I need to mention the bookmark method.

[EDIT] This method has had a major update since I wrote this article. If you follow here, you’ll see that there is a more elegant way of running code snippets but you might still like to refer to this article for simpler needs, especially when your code is not hosted.

Going Old School

I remember the days when we used to use javascript: as part of href. Some of you may have seen something like this:

<a href="javascript:void(0)">Link here</a>

When we want to execute a piece of code instead of triggering the URL, we put that javascript: bit as a starter. Then, we can put the rest the code we want to run. Although this is bad practice when it comes to coding web pages, it’s exactly what we need so we can execute any piece of code when a bookmark is hit.

The example I’m showing is for Google Chrome but it’s practically the same for Firefox. Instead of URL, you type your code in Location part of Firefox Bookmark interface. If you follow the example shown in the picture and create your bookmark, you’ll hello a kitty. Check out how I used this technique to parse book titles from Goodreads and to enhance the user experience for Safari Online Books.

Recent posts