localStorage partition - how to access localStorage with third party storage partition rollout

1k views Asked by At

Our website will break with the third party storage partition rollout, looking for the solution of that. we have two website: for example website A called: iframe.com website B called: web.com

iframe.com is embeded in web.com as an iframe. On the web.com will postMessage() to iframe.com. Once iframe.com received the message from web.com, then it will call localStroage.setItem('message', messageObject); to save the content of the message to localStorage. We found that with the third party sotrage partition rollout, the iframe.com can not read the message content which saved by web.com from localStorage anymore. That because, we save the message when we are in web.com, on web.com, we use postMessage so that iframe.com can save the message in localStorage.

In this case, how can I let iframe.com can read the message on the iframe.com itself, rather than on the web.com. Does implement first party set can help. Please kindly suggest solution, and if there is any example, that's would be great.

Thank you in advanced!

actually, there is less documents talking about the solution. not sure if implementing first party set could help

1

There are 1 answers

1
Adeel On

a quick solution is to disable it from chrome extenstion

chrome://flags/#third-party-storage-partitioning

You need to implement proper solution by using Broadcast Channel, SharedWorker, Web locks.