I have a HTML website that inside the iframe I have a <script> tag.
I can get the iframe by running:
iframe = document.getElementsByTagName("iframe")
When I print iframe[0] I received:
<iframe id="576259869" src="https://..." frameborder="0" allow="autoplay; fullscreen" allowfullscreen="" class="sc-kVrTmx jfegoL" data-ready="true"></iframe>
#document
<html lang="en">
<head>...</head>
<body>
<div id="..">...</div>
<script>...</script>
</body>
</html>
</iframe>
I tried to catch it like that:
iframe[0].getElementsByTagName("script")
But it gives me an empty arrary HTMLCollection [] although I can see the tag inside the iframe.
asked Aug 8, 2021 at 16:50
E235
13.9k29 gold badges113 silver badges163 bronze badges
default
iframe[0].contentWindow.documentit gives me the origin policy error