web.dev: Integrate with the OS Sharing UI with the Web Share API
Google’s web.dev developer site.
License: CC BY 4.0 — same basis as web.dev: Core Web Vitals Business-Impact Case Studies and web.dev: Passkey User Experience Design (code samples separately under Apache 2.0).
Key points
- The Web Share API lets a web app hand a title, some text, a URL, or a file off to the same system-level share mechanism a platform-specific app on that device would use, rather than a site building and maintaining its own list of individual social-network buttons.
- Google’s Santa Tracker team had previously removed sharing from their mobile experience entirely, since a row of several per-network share buttons cost more screen space than the team could justify. Switching to a single button wired to the Web Share API let them offer sharing again in the space of one button, and they measured roughly 20% more shares than when sharing wasn’t offered at all.
- When the same content is reachable at more than one URL (e.g. a page with a separate mobile-specific address), the article recommends sharing the page’s canonical URL rather than whatever’s currently in the address bar, so a recipient opening the link from a different device or client lands on the version meant for them rather than the sender’s own.
- Left out as implementation detail per
purpose.md: the exactshare()/canShare()method syntax, theallow="web-share"iframe attribute, the permitted-file-type list, per-browser support percentages, and the separate capability of registering a site as a receiving share target for other apps’ content.