Summary

  • The W3C's December 2019 first public Web Share draft let a website offer text or a link while the user agent supplied a chooser and the reader selected a destination.
  • The May 2023 W3C Recommendation retained that boundary and described files, canShare() validation, user action and cancellation as parts of the sharing flow.

The website has wrapped a link with a title and a little note. It brings the parcel to the counter and says, “Please send this.” Across the room are doors to messages, notes, nearby devices or other destinations. The site has no master key to those doors. The phone opens a chooser; the person holding it points. The parcel travels only after the person has had the last word.

Before a common browser API, a site might fill a page with buttons named for particular services. Those buttons expressed the site's guess about where a reader wanted to send something. A phone already had its own list of possible destinations, shaped by installed software and its interface. The Web Share API offered a narrower and more useful request: package data for sharing, then let the user agent present the choices it knows about.

The W3C's First Public Working Draft of 17 December 2019 defined an API for sharing text, links and other content to a destination chosen by the user. It left the available destinations to the user agent. Its example placed navigator.share({ title, url }) behind a button click. The user agent would then show a chooser in which the reader could select a target. A website could initiate the conversation. The address book stayed across the counter.

That first draft's economy is worth noticing. It did not require the site to know every application on a device. It defined the shape of the thing being shared and the point at which the browser should step in. The early ShareData fields covered a title, text and a URL. A publisher could offer an article link with context; the device could present destinations fitted to its own environment. Neither side had to pretend that a share menu looked identical on every phone or desktop.

By the W3C Recommendation of 30 May 2023, the description included sharing files as well as text and links. The example with a file builds a File and offers it in the files array. Another method, navigator.canShare(data), checks whether the data can be shared without opening a chooser. That gives a page a quiet question to ask while arranging its interface. The actual share() request is the moment the user is involved.

The Recommendation anchors that moment to user action. A button click is the familiar case. The browser consumes the relevant activation when a share begins and handles one active share operation at a time. It can reject a request or report cancellation. A site therefore needs a share button that appears when sharing is available, an intelligible bundle of data and a patient response to the possibility that the reader closed the chooser. None of that requires a list of friends in the page's code.

The destination list belongs to the user agent. The 2023 Recommendation says targets may be apps, websites or contacts, depending on what the environment provides. Operating-system conventions shape the presentation: one device may show a sheet, another a menu. The API's common part is the handoff, not a uniform drawing of the counter. The site's responsibility is to offer the right parcel; the phone's responsibility is to present doors it can open.

The distinction helps a reader in a simple way. A publisher can put a share action beside an article without demanding that the reader choose among that publisher's preferred platforms. The reader may send the link to a private note, a message, or a destination the publisher has never heard of. The site asks for a share flow; the device brings its current possibilities; the reader chooses. It is a small arrangement with a surprisingly clear chain of custody.

The W3C publication history records a first public draft in December 2019 and a Recommendation in May 2023. The interval saw the sharing request mature, with file data and validation described in the later text. It is a history of the specification's public documents. The core comic scene remained recognizable: a website hands over a wrapped link, then waits while someone else picks the door.

A good implementation honors the reader's gesture. The shared title and URL should say what the reader intended to send. If a file is offered, canShare() can help decide whether to show the option. When the user cancels, the page returns to its work. The chooser is a place for the reader to decide, not an occasion for the site to invent a success story about an unseen recipient.