Share session data among multiple web applications within one browser tab

29 views Asked by At

I have multiple web applications (not from the same origin) that need to work together through sharing some session specific data. Especially when these applications are running from the same browser tab, they need to share data. But not to share when running from different tabs.

Using query string is not good enough because the amount of data needs to share are too much to pass through query string.

Previously I am using an embedded iframe to share data among different applications when running from the same tab. But new Chrome storage partition made it not working anymore. https://developers.google.com/privacy-sandbox/3pcd/storage-partitioning. I am looking for a new solution.

1

There are 1 answers

0
David Bradshaw On

If you store the session info in the main page, then each time a new iframe loads, you can use the postMessage API in the browser, to pass the session info to the application that has just been loaded into the iFrame. For this to work each app will then need also use the postMessage API to listen for incoming message about the session info.