Basicly I have a cross domain iframe and can't enable the allow-scripts flag, but at the same time I need to get the postMessage that is in a <script>
tag in the iframe document OR access the iframe contentDocument.
I've tried:
let iframeElement = document.getElementsByTagName('iframe')[0];
let iframeContent = iframeElement.contentDocument
console.log(iframeContent)
But with the sandbox flag I only get a null
return.
What I need to be able to do is one of those three options:
- Add a eventListener to a tag that's insde the iframe contentDocument
- Get a attr value that's also inside the iframe contentDocument
- A way to send a JSON from the origin page and get this JSON in the page with the iframe (postMessage)
But all of this without the allow-scripts flag, is what i'm trying to archieve even possible ?