navigator.share()
Secure context: This feature is available only in secure contexts (HTTPS), in some or all supporting browsers.
The share() method of the Navigator interface invokes the native sharing mechanism of the device to share data such as text, URLs, or files. The available share targets depend on the device, but might include the clipboard, contacts and email applications, websites, Bluetooth, etc.
The method resolves a Promise with undefined. On Windows this happens when the share popup is launched, while on Android the promise resolves once the data has successfully been passed to the share target.
The Web Share API is gated by the web-share permission policy. The share() method will throw exceptions if the permission is supported but has not been granted.
Browser support
| Feature | Desktop | Mobile | ||||
|---|---|---|---|---|---|---|
| Chrome | Edge | Firefox | Safari | Chrome Android | Safari iOS | |
| 128 | 93 | 71 | 12.1 | 61 | 12.2 | |
| DOM API | ||||||
| The canShare() method of the Navigator interface returns true if the equivalent call to navigator.share() would succeed. | 128 | 93 | 96 | 14 | 75 | 14 |
canShare (data files parameter) `data.files` parameter | 89 | 81 | | 14 | 76 | 14 |
canShare (data text parameter) `data.text` parameter | 89 | 81 | 96 | 14 | 76 | 14 |
share (data files parameter) `data.files` parameter | 89 | 81 | | 14 | 76 | 14 |
share (data text parameter) `data.text` parameter | 89 | 81 | 71 | 14 | 76 | 14 |
| Other | ||||||
html.elements.iframe.allow.web-share | 86 | 86 | 81 | | 86 | |
http.headers.Permissions-Policy.web-share Experimental The HTTP Permissions-Policy header web-share directive controls whether the current document is allowed to use the Navigator.share method of the Web Share API to share text, links, images, and other content to arbitrary destinations of the user's choice. | 88 | 88 | | | 88 | |
- This browser only partially implements this feature
- This feature was removed in a later browser version (128)
- Only supported on ChromeOS and Windows, see bug 40542648 and bug 40729163.
- This browser only partially implements this feature
- This feature was removed in a later browser version (93)
- Only supported on Windows.
- Requires an experimental browser flag to be enabled
- This browser only partially implements this feature
- This feature was removed in a later browser version (128)
- Only supported on ChromeOS and Windows, see bug 40542648 and bug 40729163.
- This browser only partially implements this feature
- This feature was removed in a later browser version (93)
- Only supported on Windows.
- Requires an experimental browser flag to be enabled
- Requires an experimental browser flag to be enabled
- Requires an experimental browser flag to be enabled
- Firefox recognizes the `web-share` permissions policy, but this has no effect in versions of Firefox that do not support the `share()` method.
Syntax
await navigator.share({
title: 'Page Title',
text: 'Recommended Articles',
url: 'https://example.com/article'
}); Use cases
-
Use navigator.share()
Use navigator.share() when standard HTML needs a more specific platform feature, semantic signal, or browser capability.
-
Handle edge cases
Apply navigator.share() to solve a focused requirement without redesigning the whole page architecture.
Cautions
- Test navigator.share() in your target browsers and input environments before depending on it as a primary behavior.
- Provide a fallback path or acceptable degradation strategy when support is still limited.
Accessibility
- Make sure navigator.share() supports the intended task without making the page harder to perceive, understand, or operate.