Two Bookmarklets

July 13, 2024 • Louie Mantia

I love bookmarklets. They are an incredibly useful way to add browser functionality without extensions. I have two I want to share with you.

If you think the code for either of these is inefficient, just reply to me on Mastodon or send an email. I’m not an expert here.

To make a bookmarklet, bookmark any page inside Favorites. Then, choose “Edit Address…” and paste the javascript. Rename the bookmarklet to whatever you like.


Wikipedia

This opens a new tab and searches the English Wikipedia for the selected text on the current page. If you’ve selected no text, it goes to the Wikipedia home page. You can edit this for other versions of Wikipedia.

This is a lot faster than “Look Up” or “Search” in Safari.

javascript:(function(){var selectedText=window.getSelection().toString().trim();var searchUrl=selectedText?'https://en.wikipedia.org/wiki/Special:Search?search='+encodeURIComponent(selectedText):'https://en.wikipedia.org/wiki/Main_Page';window.open(searchUrl,'_blank');})();

Wayback Machine

This searches for previous incarnations of the current page on the Wayback Machine from Archive.org. Any time I hit a dead link or a paywall, I click this.

javascript:(function()%7Bvar%20url%20%3D%20document.URL%3B%0Avar%20newURL%20%3D%20%60https%3A%2F%2Fweb.archive.org%2Fweb%2F%24%7Burl%7D%60%3B%0A%0Awindow.location.href%20%3D%20newURL%3B%7D)()%3B

Got a bookmarklet you love? Share it with me! I’m curious.