--- url: "https://web.dev/articles/files/receive-shared-files/pattern" titulek: "web.dev" h1: "" popis: "" jazyk: "en" kanonicka: "https://web.dev/articles/files/receive-shared-files/pattern" drobecky: [] zdroj: "live" wayback_snapshot: "" stazeno: "2026-09-14 03:30:28" znaku: 1982 slov: 254 kodovani: "iso-8859-2" sha256: "2669de5214e491fff1bf5ec6b6f82baf44a089b9a71eb1dc16cfad8b0e1626f5" --- Stay organized with collections Save and categorize content based on your preferences. HTML ` How to receive shared files

How to receive shared files

Install the app. After the installation, try sharing an image to it from another app. ` CSS `html { box-sizing: border-box; font-family: system-ui, sans-serif; color-scheme: dark light; } *, *:before, *:after { box-sizing: inherit; } body { margin: 1rem; } img { height: auto; max-width: 100%; display: block; }` JS `window.addEventListener('load', async () => { if (location.search.includes('share-target')) { const keys = await caches.keys(); const mediaCache = await caches.open( keys.filter((key) => key.startsWith('media'))[0], ); const image = await mediaCache.match('shared-image'); if (image) { const blob = await image.blob(); await mediaCache.delete('shared-image'); // Handle the shared file somehow. } } });` Except as otherwise noted, the content of this page is licensed under the [Creative Commons Attribution 4.0 License](https://creativecommons.org/licenses/by/4.0/), and code samples are licensed under the [Apache 2.0 License](https://www.apache.org/licenses/LICENSE-2.0). For details, see the [Google Developers Site Policies](https://developers.google.com/site-policies). Java is a registered trademark of Oracle and/or its affiliates. Last updated 2026-07-29 UTC.