Sorry but I think in Chrome there is a setting that needs to be turned off for this to work
Jul 28, 2022
1
Level 14
Reading from own LocalStorage is denied within an iframe
Hi everyone,
I have an iframe where I embed another website (they are on different domains) and the embedded website tries to read data from it's own local storage. So the embedded website doesn't try to access the parent window or vice versa.
The error I get:
Uncaught DOMException: Failed to read the 'localStorage' property from 'Window': Access is denied for this document.
The code to read the data from localStorage in the embedded website:
localStorage.getItem('auth')
Again, I don't try to read data from the other domain. I tried to read data from it's own Window object.
Do you know any solutions for this? (Except changing the browser settings)
Thank you in advance.
UPDATE
Looks like it's working in Safari, so I only get this error in Chrome.
Please or to participate in this conversation.