Skip to content

Instantly share code, notes, and snippets.

@hmans
Last active December 22, 2022 03:11
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hmans/eebda20ee21c81ad6811d15739715aaa to your computer and use it in GitHub Desktop.
Save hmans/eebda20ee21c81ad6811d15739715aaa to your computer and use it in GitHub Desktop.
Mastodon Follow/Interact Bookmarklet

Mastodon Follow/Interact Bookmarklet

All desktop browsers (I think/hope) support bookmarklets -- bookmarks that contain JavaScript code which is run when you select them. This bookmarklet makes it easier to follow users or interact with toots from other Mastodon instances by passing their URLs back to your home instance, where you can then follow/interact with them normally.

The bookmarklet:

javascript:var host="mastodon.social";if(document.location.hostname==host){alert("Already on your own instance!")}else{document.location=("https://"+host+"/authorize_interaction?uri="+encodeURIComponent(document.location))}

Here's how to set it up in Chrome:

  • Make sure your bookmarks bar is visible (Ctrl-Shift-B in Windows and Linux, Cmd-Shift-B in macOS)
  • Right click on it, select "Add Page"
  • Enter any title in the "Name" field
  • Copy the above JavaScript into the "URL" field
  • Important: Finally, change the hostname of your instance in the beginning of the script!

Now, whenever you're viewing a user profile or post on a remote Mastodon instance in your browser, hit that bookmarklet, and it will take you back to your home instance, where you can follow or interact with it.

Enjoy!

@hmans@norden.social

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment