Web Share API: One Byte Explainer ✍️
Rajeev R. Sharma

Rajeev R. Sharma @ra_jeeves

About: Entrepreneur. Fullstack dev.

Location:
Gurugram, India
Joined:
Mar 12, 2017

Web Share API: One Byte Explainer ✍️

Publish Date: Mar 29 '24
5 0

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

Comments 0 total

    Add comment