Anthony
Anthony

Reputation: 599

Can PWA share state/data between browsers?

If I have multiple browsers, can PWA share states or data? For example if I’m offline and I interact with the app on Firefox, save some data, etc. Can I access that same data when I open the app in Chrome? I tried it with https://voice-memos.appspot.com/ but it doesn’t work. Perhaps an unimplemented feature?

Upvotes: 3

Views: 932

Answers (2)

Kornel
Kornel

Reputation: 100120

Browsers have their own private storage for web apps, and there's no API designed specifically for direct, seamless cross-browser data sharing, so only workarounds are available.

When online you can share the data by synchronizing it via a server. This may even be near-realtime with the help of SSE/WebSockets or push notifications.

When offline I don't think you can in any sensible way. You could instruct the user download a file in one app and select it in a file picker in another app (or use drag'n'drop or copy'n'paste). Maybe (I haven't tested) you could establish WebRTC data connection between browsers while online and it'd survive going offline if the direct p2p connection was made over loopback/LAN.

Upvotes: 1

Marco Castelluccio
Marco Castelluccio

Reputation: 10802

No, you can't. The browsers implement the cache in different ways, they store the data in different directories, etc..

Upvotes: 2

Related Questions