OiO.lk Community platform!

Oio.lk is an excellent forum for developers, providing a wide range of resources, discussions, and support for those in the developer community. Join oio.lk today to connect with like-minded professionals, share insights, and stay updated on the latest trends and technologies in the development field.
  You need to log in or register to access the solved answers to this problem.
  • You have reached the maximum number of guest views allowed
  • Please register below to remove this limitation

Set data in a cross-domain localStorage by iframe

  • Thread starter Thread starter lei li
  • Start date Start date
L

lei li

Guest
I want to set cross-domain localStorage data, I created an embedded page to receive and set localStorage data b.com/receive.html which listen window's message event, and set the received data into localStorage. The host page is a.com/host.html which has an IFrame element to connect and post data to embedded page.

The embedded page could receive data and set localStorage when it is in IFrame. But if I access the embedded page directly, the localStorage is not which is in IFrame although the tow pages has same origin.

Is localStorage separated is IFrame?

<p>I want to set cross-domain localStorage data, I created an embedded page to receive and set localStorage data <code>b.com/receive.html</code> which listen window's <code>message</code> event, and set the received data into localStorage. The host page is <code>a.com/host.html</code> which has an IFrame element to connect and post data to embedded page.</p>
<p>The embedded page could receive data and set localStorage when it is in IFrame. But if I access the embedded page directly, the localStorage is not which is in IFrame although the tow pages has same origin.</p>
<p>Is localStorage separated is IFrame?</p>
 
Top