I have a problem with iframe. In my application I'm using the html of other different pages, passing this to iframe, as srcdoc. But they may have their own iframe with srcdoc too. And when I'm trying to modify this nested iframes (add some styles, add event listiners, so on) - I have this error
If I'm running app not on my local machine - the origin changed to another url.
This happen only with some nested iframe, never with my first order iframe. I'm adding dynamically sandbox=allow-same-origin
to all iframes that I've found, before editing, but this not working for me.
The question is, how to solve this, how browser understand, that this iframe have cross-origin error, and this not?
One more time, I'm using the iframes with srcdoc, so there is no other origin there. I'm not trying to get another's code, and change this. I have the originals htmls, and just passing this to iframe, and trying to edit.