Lesson 20 / 30

Share target API

Register your PWA as a share target so users can send text, links and files into it from the system share menu.

Receiving shared content

Share target makes your PWA appear in the system share menu. Users can share text, links, or files from other apps directly into your app.

Configure share target

Add share_target to manifest and handle shared content in your page.

"share_target": {
  "action": "/share",
  "method": "POST",
  "enctype": "multipart/form-data",
  "params": {
    "title": "title",
    "text": "text",
    "url": "url",
    "files": [
      {
        "name": "file",
        "accept": ["image/*", "application/pdf"]
      }
    ]
  }
}

Output:

App appears in system share menu and receives shared content.