<aside> 💡 “A share target is the abstract concept of a destination that the user agent will transmit the share data to. What constitutes a share target is at the discretion of the user agent.” - WCIG
</aside>
Here, I would look into sharing using the native share feature on the web. Making your PWA available requires two simple steps:
Updating your manifest.json with the code below:
. . . ,
"share_target": {
"action": "share-target",
"method": "GET",
"enctype": "application/x-www-form-urlencoded",
"params": {
"title": "title",
"text": "text",
"url": "url"
}
}
A detailed explanation of the code above:
share_target
takes an object of details needed to make your PWA a share targetshare_target.action
takes a relative URL path to the page where the shared data will be used.share_target.method
takes the method you define to accept the shared data. Its default value for this is GET.share_target.enctype
takes the type of coding via which you would receive the shared data.share_target.params
take an object that specifies the attributes you intend to accept the shared data.Once an app is selected as a share destination, the data is sent to the page previously specified in the share_target.action
- in the form of a REST API call.