Web Share Target API

I'm constantly worried that on the web platform we are creating unintended silos by making it harder to get data in and out of web sites and apps, more importantly I worry that the data only flows one way: from the web to apps, because apps can be in all the places that users expect them to be on their devices.

I was pretty pleased that Chrome started to work on the Web Share Target API that complements the work on navigator.share. Where navigator.share lets you share information out of your web site to any app on the users device that can receive 'shares' (Intent.ACTION_SEND in Android parlance), the Web Share Target lets your web site (or PWA) say 'I want to play in that game too'.

I'm pretty pleased to say that this work is now available in Chrome Canary on Android.

The Web Share Target API is a small API that you define in your Web App Manifest. If you have ever used registerProtocolHandler you will see that it's not a million miles away — you define a URL template that has a number of variables in that will be substituted when the user invokes the action.

First you create an 'object' property called share_target that contains one property called url_template that has the path that should be opened when the user chooses our service. On Android, you can use the three substitution names called:

You can try this today by installing Twitter's PWA. Twitter's manifest is below:

    "name": "Twitter Lite",
    "share_target": {
        "url_template": "compose/tweet?title={title}&text={text}&url={url}"

Right now there are some limitations:

Limitations aside, this is a rather amazing addition to the web platform that is the start of breaking down the huge barriers that the web has with regards to integration on the host platforms.

If you want to track updates to this API, check out Chrome Status.

I lead the Chrome Developer Relations team at Google.

We want people to have the best experience possible on the web without having to install a native app or produce content in a walled garden.

Our team tries to make it easier for developers to build on the web by supporting every Chrome release, creating great content to support developers on web.dev, contributing to MDN, helping to improve browser compatibility, and some of the best developer tools like Lighthouse, Workbox, Squoosh to name just a few.

I love to learn about what you are building, and how I can help with Chrome or Web development in general, so if you want to chat with me directly, please feel free to book a consultation.

I'm trialing a newsletter, you can subscribe below (thank you!)