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
A related real life issue I faced while using the
Web Share API
& theclipboard API
Learn how to make your app receive the shared content and appear in the native share dialogs: Web Share Target API
Top comments (0)