I want to set the SessionStorage of an iframe which is located on my page. However, the site in the iframe and my site have different domains. How can I handel that? Thanks in advance ! :)
Asked
Active
Viewed 2,788 times
1 Answers
2
If the iframe embed a content that have the same origin has your host website, they will share the same session storage.
If the iframe don't have the same origin as your host website, but you have control over it, you can maybe implement something with the postMessage API, to communicate with your iframe.
If the iframe don't have the same origin as your host website, and you don't have control over it, you can't modify it's session storage for security reasons.
Take a look at this SO thread: sessionStorage in iframe for more info.

geauser
- 1,005
- 8
- 20