DEV Community

Cover image for Web Share API: One Byte Explainer ✍️
Rajeev R. Sharma
Rajeev R. Sharma Subscriber

Posted on • Updated on

Web Share API: One Byte Explainer ✍️

This is a submission for DEV Challenge v24.03.20, One Byte Explainer: Browser API or Feature.

Explainer

Web Share APIs are used to share text, links, files and other contents in web apps by showing the native share dialogs.

navigator.canShare() validates content shareability, and navigator.share() opens the native share dialog.

Additional Context

Web Share APIs use the web-share permission policy, and your app must have the permission granted for the API to work. Also, the sharing must be triggered by a UI event (e.g. button click).

For more information you can visit the MDN docs

Other Resources

  1. A related real life issue I faced while using the Web Share API & the clipboard API

  2. Learn how to make your app receive the shared content and appear in the native share dialogs: Web Share Target API

Top comments (0)