DEV Community

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

Posted on • Edited on

2 1 1 1

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

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

Top comments (0)

Billboard image

Create up to 10 Postgres Databases on Neon's free plan.

If you're starting a new project, Neon has got your databases covered. No credit cards. No trials. No getting in your way.

Try Neon for Free →

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay