Much to my shame, I first came across a feature of web-browsers that had been developed way back in 2001 – the bookmarklet.

What a bookmarklet is, is a regular browser bookmark that has a piece of javascript for its address instead of the usual url, by using the javascript: prefix instead of the usual http: or http:. I had known for a long time that the address bar of most browsers support this, but did not even think that this functionality extended to bookmarks.

What this means though, is that you are able to insert almost any imaginable script into a bookmark.

Here is an example, which I found on the Wikipedia page on bookmarklets, which opens up the relevant Wikipedia article based on the selected text within your current document, which can be a great timesaver.

javascript:function se(d) {return d.selection ? d.selection.createRange().text : d.getSelection()} s = se(document); for (i=0; i<frames.length && !s; i++) s = se(frames[i].document); if (!s || s=='') s = prompt('Enter%20search%20terms%20for%20Wikipedia',''); open('http://en.wikipedia.org' + (s ? '/w/index.php?title=Special:Search&search=' + encodeURIComponent(s) : '')).focus();
Share