# Sharing data between web browsers

**URL:** <https://discuss.ipfs.tech/t/sharing-data-between-web-browsers/18805>\
**Category:** Helia\
**Tags:** browsers\
**Created:** [December 20, 2024, 12:33pm UTC](https://discuss.ipfs.tech/t/sharing-data-between-web-browsers/18805 "2024-12-20T12:33:47Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![bthj](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ipfs.tech/bthj/32/8846_2.png) [@bthj](https://discuss.ipfs.tech/u/bthj)\
**Post date:** [December 20, 2024, 12:33pm UTC](https://discuss.ipfs.tech/t/sharing-data-between-web-browsers/18805/1 "2024-12-20T12:33:47Z")

</div>

Can data be shared directly between web browsers via IPFS?

Let’s say browser A reads data from disk via the [File System API](https://developer.mozilla.org/en-US/docs/Web/API/File_System_API) and adds it to IPFS with Helia. Some CIDs are created for the data files, and while I’m still trying to wrap my head around the possibility of [decentralised discoverability](https://discuss.ipfs.tech/t/finding-content-by-type/18556), let’s maybe for now assume browser A publishes those CIDs to some centralised storage.

Browser B, also empowered by Helia, would like to access the data which browser A has added to IPFS. Assuming browser B has somehow obtained the CIDs, e.g. from the centralised storage, can it access the data from browser A, while it is open / online?

The [Helia with React+Vite](https://github.com/ipfs-examples/helia-examples/tree/main/examples/helia-vite) example is interesting, but I haven’t found an example of browser to browser communication.

---

<div class="post-metadata">

**Author:** ![danieln](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ipfs.tech/danieln/32/6408_2.png) [@danieln](https://discuss.ipfs.tech/u/danieln)\
**Post date:** [December 20, 2024, 12:56pm UTC](https://discuss.ipfs.tech/t/sharing-data-between-web-browsers/18805/2 "2024-12-20T12:56:09Z")

</div>

> [@bthj](#):
>
> Browser B, also empowered by Helia, would like to access the data which browser A has added to IPFS. Assuming browser B has somehow obtained the CIDs, e.g. from the centralised storage, can it access the data from browser A, while it is open / online?

Yes. If the browsers are behind NAT, there are some cases where NAT traversal with WebRTC fails, in which case it won’t work.

But generally this approach works:

See the following example: [GitHub - ipfs-shipyard/ipfs-share-files: Share files directly from the browser using IPFS.](https://github.com/ipfs-shipyard/ipfs-share-files)

Deployed to:  
[https://share.ipfs.io/](https://share.ipfs.io/)

---

<div class="post-metadata">

**Author:** ![bthj](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ipfs.tech/bthj/32/8846_2.png) [@bthj](https://discuss.ipfs.tech/u/bthj)\
**Post date:** [December 20, 2024, 2:11pm UTC](https://discuss.ipfs.tech/t/sharing-data-between-web-browsers/18805/3 "2024-12-20T14:11:04Z")

</div>

That’s great, thanks!

I tried [https://share.ipfs.io/](https://share.ipfs.io/) by sharing a small file in one browser (Chrome) on my desktop: after several minutes a sharing link appears, which I tried pasting to another browser on the same desktop (Firefox); after around five minutes a disabled Download button appears.

Currently I’m on a typical domestic Internet connection, which probably means I’m behind NAT?

Could this somehow be improved with a custom introducer / relay server?

---

<div class="post-metadata">

**Author:** ![danieln](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ipfs.tech/danieln/32/6408_2.png) [@danieln](https://discuss.ipfs.tech/u/danieln)\
**Post date:** [December 20, 2024, 2:24pm UTC](https://discuss.ipfs.tech/t/sharing-data-between-web-browsers/18805/4 "2024-12-20T14:24:57Z")

</div>

It’s probably because it attempts to announce to the DHT, which takes time and is probably unnecessary since your multiaddrs for an ephemeral browser tab are very short lived.

We could improve it by embedding the multiaddr into the link and then optimistically connect to it on the other side.
