Let’s face it, we all get a little rush when someone shares our content to their social media audience.

But sharing a web page to social media is complicated, right?

No!

The Web Share API brings native content sharing to the web, a feature previously limited to native apps to websites. Now you can offer a native way to share links, text and other content from a web page to the user’s desired target. Targets can be social media platforms, SMS, email or other registered share targets.

You will see how the Web Share API works and how to create a fallback option for browsers not yet supporting this API.

What is Web Sharing?

There are many ways websites have tried to encourage visitors to share the page on social media. Many sites use WordPress Social share plugins or inject scripts supplied by different social media platforms.

The problem with these scripts is they inject lots of excessive JavaScript that add little value and

How do you use link sharing?

slow your page speed down . They also limit choice to the website, not the user.Most browsers, like Chrome for Android do have a native share option available, but it requires the user to dig through the browser settings menu and does not provide flexibility over what gets shared. You will also find it in Edge and Chrome desktop browsers.

You are limited to just the current URL. Plus when a progressive web app is displayed using full screen or standalone modes the browser’s menu is not available.

There have been several attempts to make sharing content available to websites, such as Web Activities and Web Slices. Oh, slices I remember when they were unveiled at Mix so long ago…

Native apps have long had an advantage by offering platform share integration. This is where you can add a button to the app and it will launch a native component displaying a dialog or ‘shelf’ of possible share targets.

#api #web share api

How Can You Use the Web Share API?
1.65 GEEK