The File Web Share Target API is a new, powerful feature in Chrome Canary that allows web apps to receive files (like images) shared from other apps, much like native apps. This post details how I implemented this API on my blog, enabling direct image uploads from my Android camera app. The process involves declaring support for file sharing in your web app manifest and handling the incoming file data in a service worker. The API uses a progressive approach, leveraging standard form POST requests, making integration relatively simple. This feature significantly enhances web app integration with the host operating system, closing the gap between web and native apps.
The Web Share Target API is now available as an origin trial in Chrome, bridging the gap between web and native apps. Previously, only native apps could register as share targets, limiting the web's ability to seamlessly integrate with system-level sharing functionalities. This new API empowers installed web apps to receive shared content, opening up exciting possibilities for web developers. The API's potential is highlighted by Twitter's early adoption and my own experimentation with a custom manifest.json file. While file support is still pending, the future looks bright for effortless content sharing between web and native environments.