Skip to main content
open({ title?, message?, url? }) resolves true when the user shared. In the desktop shell on macOS, this opens the system share menu (Messages, Mail, AirDrop, Notes and so on) where the user pressed your button. On Windows and Linux the shell copies the text and link to the clipboard and says so in a notification. For links to a profile, build the URL with userPageUrl, not window.location.

Drag files out (desktop)

In the desktop shell, an element can be dragged out of your app as a file: onto Finder, the desktop, a Mail message or another app. Spread fileDragProps onto it:
The shell fetches the file while the pointer is over the element, so it is on disk when the drag starts. A drag that starts before the file has arrived does nothing, and the user can try again a moment later. url must be a public https URL, because no app token is sent, and the file can be up to 200 MB. Outside the desktop shell the attributes do nothing.

Files on the device

uri must be a file the shell can read, such as a nativeUri returned by the camera.

Generated documents

shareContent shares a file your page built itself, such as an export or a PDF. Inside a shell, <a download> and window.print() do nothing, so this is how a user gets the file out.
string
required
The file contents.
'utf8' | 'base64'
default:"'utf8'"
Use base64 for binary files.
string
required
Name the shell saves it under.
string
Content type.
string
Share sheet title (Android).
It resolves { shared?, error? }, with error being not_available or failed. It answers not_available outside a shell and in shell versions that predate it, so always keep a browser download path.
Outside a shell, open resolves false and shareFile resolves error: 'not_available'. In a browser, use navigator.share or a download link.