Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Share on Mastodon button

A simple script to provide a "share on mastodon" button without any styles. To use it, add the script and put a link where you want to share to mastodon.

I've made all the things you want to show to the user editable in the link.

    <a href="#" rel="noreferrer noopener" 
        target="mastodon" 
        data-prompt="Please tell me your Mastodon instance" 
        data-edittext="✏️" 
        data-editlabel="Edit your Mastodon instance" 
        class="mastodon-share">
        Share to Mastodon
    </a>
    <script src="mastodon-share.js"></script>

The first time users click the share button, it asks for their mastodon instance and stores it in local storage. Subsequently you can just click the link. Here's how that looks as a GIF recording:

Recording of the interaction

You also get an edit link next to the share button to edit your instance in case you made a mistake.

See it in action

About

A share to mastodon button

Resources

Stars

11 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages