Web Share API

An API allow sharing of information using the native OS sharing capabilities.

Status:

How it works

Just a very simple view to see how the API works:


<button onclick="share();">Share</button>
<script>
    function share() {
        if (navigator.share) {
            navigator.share({
                    title: "Title to Share",
                    text: "Text to Share",
                    url: "https://www.russwurm.com/web-share-api-intro",
                })
                .then(() => console.log('Successful share'))
                .catch((error) => console.log('Error sharing', error));
        } else {
            console.log("Web Share API is not supported in your browser.")
        }
    }
</script>

Links

Web Share API with Fallback