canShare method

bool canShare([
  1. ShareData data
])

The canShare() method of the Navigator interface returns true if the equivalent call to navigator.share would succeed.

The method returns false if the data cannot be validated. Reasons the data might be invalid include:

  • The data parameter has been omitted or only contains properties with unknown values. Note that any properties that are not recognized by the user agent are ignored.
  • A URL is badly formatted.
  • Files are specified but the implementation does not support file sharing.
  • Sharing the specified data would be considered a "hostile share" by the user-agent.

The Web Share API is gated by the web-share permission policy. The canShare() method will return false if the permission is supported but has not been granted.

Implementation

external bool canShare([ShareData data]);