Lesson 19 / 29

Share target API

Allow users to share content with your PWA from other apps.

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.