A bookmarklet for Bluesky sharing

A blue butterfly sat on a stony surface
Photo by Andra C Taylor Jr / Unsplash
TLDR: drag the link at the button at the bottom of this page to your browser's bookmarks; use it to share any page you like. Maybe this one?

I recently wrote about adding Bluesky sharing buttons to a webpage so that anyone can easily share your content with their Bluesky followers. Let's flip that now, and look at how you can easily share other people's content from your browser.

Bookmarklets use the humble browser bookmark to extend some functionality to the browser, via JavaScript. Instead of loading a URL, a function is run that opens a web page and performs some sort of action upon it.

My Bluesky bookmarklet will open Bluesky in the compose view, and pre-populate the post that's being written with data from the referring page. It will pass the page's title as txt, and then add the URL too, like this:

The Bluesky post composer UI on a desktop browser

I already know that the action intent links provide a simple way to get to the post composer, so a lot of the work I already did comes in useful here. What also comes in useful is that fact that social sharing bookmarklets have been around for years, and I can find the basic idea I need by looking for Twitter/X sharing bookmarklets. Building off of that, we get to this bit of JavaScript—the Share on Bluesky bookmarklet:

javascript:(function(){window.open('https://bsky.app/intent/compose?text='+encodeURIComponent(document.title)+' '+encodeURIComponent(window.location.href));})();

Add to the address of a bookmark to make a Bluesky sharing button for your browser

Installing the bookmarklet

  1. Create a new bookmark in your browser—it doesn't matter what it goes to
  2. Edit the text label ("Rename" it). I suggest calling it "Share on Bluesky" but use whatever label makes sense to you
  3. Edit the address of the bookmark: delete the existing URL, replace with the line of JavaScript given above

Or, drag and drop this into your bookmarks 🎉

🦋
I'd love you to say "Hi" on Bluesky—@jonhickman