Farewell to bookmarklets

This post originated as http://blog.jonudell.net/2015/05/13/farewell-to-bookmarklets/ in the voice of Jon Udell, not the voice of Hypothesis. I posted it here in part to explore how Hypothesis can attach annotations to documents that are the same or similar. Dan Whaley made some annotations to the WordPress preview here that reflect the voice of Hypothesis. Now what? Do I incorporate some or all of those edits into this version of the document? Into the original as well?

In the end I decided to interpolate his annotations into the text here, though you’ll also be able to view them in context using Hypothesis. And if I get the aliasing right, his annotations will propagate to my original post as well. It’s a fascinating and fun experiment!

The Hypothesis web annotation system is a browser-based application that talks to an annotation server, finds annotations for the current page (if any), highlights the selections to which the annotations refer, and dispays them in a sidebar alongside the page. We load a fair bit of JavaScript to do our job, and in the olden days we would simply have relied on bookmarklets to activate that code.

But times change, and bookmarklets are mostly dead. They’re not all dead yet. I expect I’ll still be able to use simple ones, like pinboard.in‘s, for a long time to come. But a new security regime limits the scope of what bookmarklets can do, and is forcing developers to create browser extensions instead — extensions that must be created and deployed differently for each browser. [Dan’s annotation]

So the realm of web applications that extend the browser is now becoming as balkanized as the realm of mobile apps. [Dan’s annotation] Developers target the dominant platform first — currently, that’s Chrome — and then port their extensions to other browsers as and when they can.

There’s another way to add behavior to a web page, though. You can send the page through an intermediate server (a proxy) that injects that behavior as the bookmarklet or extension would do. The Hypothesis proxy is via.hypothes.is, and you can use it to activate annotation for any web page — including this one — like so:


The nice thing about this combo URL is that you can share the annotated page along with its annotation layer. Of course there are tradeoffs:

– Properly rewriting all the URLs in the proxied page is a tricky business.

– You can’t annotate pages behind paywalls (as you can with our bookmarklet and Chrome extension). [Dan’s annotation]

– You still need a way to activate the annotation layer for the current page. (You can use a bookmarklet to redirect to the proxy, but … sigh.)

The upshot is that we’re struggling to simplify the decision tree that Hypothesis users must traverse. You want to activate annotation for your current page? If in Chrome, install the extension, otherwise for Firefox or Safari or IE use the bookmarklet, unless the page enforces Content Security Policy, in which case use the proxy, unless the page is behind a paywall, in which case, sorry, you’re out of luck. [Dan’s annotation]

And that’s just for the desktop! Mobile browsers make things even crazier. I’m able to perform the gymnastics required to use the Hypothesis bookmarklet on my Windows Phone, on my iPhone, and (most acrobatically) on my Android tablet, and I really need to document those procedures, but it’s so depressing I’ve avoided doing so.

What seems most promising, for mobile browsers, is to add Hypothesis as an option that shows up when you ask to Share a web page. Activating annotation for the current page isn’t really Sharing, but the Share mechanism looks like the sanest [Dan’s annotation] way to redirect through the proxy, which in turn looks like the sanest way to activate the annotation layer in mobile browsers.

It looks reasonably straightforward to create an Android app that shows up when you Share a page and broadcasts the intent to view the proxied version of that page. Things look a bit more complex on iOS. Should there be a Safari-specific extension that redirects to the proxy? A system-wide Share extension that Chrome could also use? Both?

Of course activating Hypothesis on the mobile browser is only half the battle. As a sidebar-based app we manage pretty well on the desktop and large tablets, but are uncomfortable on smaller screens. If we’re routing through a proxy anyway, maybe the proxy should also do a Readability-style rewrite to simplify the page. We’re good at fuzzy anchoring and can anchor annotations to different representations of the “same” document.

There’s lots to do, and while bookmarklets will continue to help us do it, their era is over. Browsers are more standards-compliant than ever, which makes our mission to bring an annotation layer to the web easier than it would have been five or ten years ago. But browsers are now also less easily extensible and that’s a new challenge.