Navigator.canShare()

このロケールの翻訳が存在しないため、英語バージョンのコンテンツを表示しています。 Help us translate this article!

This is an experimental technology
Check the Browser compatibility table carefully before using this in production.

Secure context
This feature is available only in secure contexts (HTTPS), in some or all supporting browsers.

The Navigator.canShare() method of the Web Share API returns true if a call to Navigator.share() would succeed.

Syntax

var canShare = navigator.canShare(data);

Parameters

data Optional
An object containing data to share that matches what you would pass to Navigator.share().

Return value

A Boolean. True if data can be shared with Navigator.share().

Exceptions

None.

Examples

if(navigator.canShare(data)) {
  // We can use share() to share the data! Woop!
}

Specifications

Specification Status Comment
Web Share API - Level 2
The definition of 'canShare' in that specification.
Draft Initial definition.

Browser compatibility

Update compatibility data on GitHub
DesktopMobile
ChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidFirefox for AndroidOpera for AndroidSafari on iOSSamsung Internet
canShareChrome No support NoEdge No support NoFirefox No support NoIE No support NoOpera No support NoSafari No support NoWebView Android No support NoChrome Android Full support 75Firefox Android No support NoOpera Android No support NoSafari iOS No support NoSamsung Internet Android No support No

Legend

Full support  
Full support
No support  
No support

See Also

navigator.share()