Luke Hagan

Make the Instapaper bookmarklet work harder

Make the bookmarklet open Instapaper if activated on a blank page.

Update 2/16/2015: This is an old post and the Instapaper bookmarklet has been updated quite a bit since I wrote it. It’s probably still possible to modify the bookmarklet to open Instapaper’s site, but these instructions likely won’t work verbatim.

Instapaper is a really useful tool. And not just for saving long web articles for reading later. I use it as a temporary bookmarking system of sorts for pages of all kinds – apps I want to download, sources of design inspiration, services to try out, etc. For me, what sets Instapaper apart is the bookmarklet. It’s just so fast and universal – it works exactly the same way on my Mac at home, Windows computer at work, iPad, and iPhone with no logins, confirmation screens, switching apps, etc. While Instapaper doesn’t have the awesome search capabilities of Evernote or Devonthink, I find that it’s a much better way to quickly capture things to read or take action on later.

However, that simple “Read Later” bookmarklet can do more. For a while, I had “Read Later” and “Instapaper” on my Safari bookmarks bar (the latter being a bookmark to the Instapaper site). But why use two spaces on the bar, when one will do? Just a few small changes are needed in order to make “Read Later” work like a plain old bookmark.

In case you didn’t know, bookmarklets are really Javascript functions (the scripting language of the web). Instead of simply telling your browser to go to some web address like a regular bookmark, a bookmarklet runs its Javascript on the page you currently have open[^1]. So, to make “Read Later” work as a link, I reconfigured it a bit to detect when it has been run on a blank page[^2], then tell the browser to go to http://www.instapaper.com/u (the unread items list) like so:

...
} catch(e) {
    if (d.location.href == 'about:blank') {
        window.location.href = 'http://www.instapaper.com/u';
    } else {
        alert('Please wait until the page has loaded.');
    }
}
...

To implement this change in your Instapaper bookmarklet, you’ll need to do two things:

  1. Set your homepage to about:blank, otherwise this won’t work.
  2. Edit the bookmarklet by right-clicking on it, selecting “Edit Address,” and replacing the following section:
catch(e){alert('Please%20wait%20until%20the%20page%20has%20loaded.');}

with this:

It’s as simple as that[^3]!

[^1]: I think this is really cool. Yes, I know, I’m a geek.

[^2]: Normally, if you click “Read Later” on a blank tab, it’ll pop up a dialog box telling you to wait for the page to finish loading, since it didn’t find any content to send to the Instapaper server.

[^3]: Or not. It’s critical that you only replace the code fragment identified above, otherwise the whole bookmarklet may not work at all. Just make your selection carefully, and you should be fine.