@edmond_brakus
To get the whole content of an iframe using JavaScript, you can use the contentWindow
property of the iframe element and then access the document
property of the content window. You can then retrieve the content of the iframe as follows:
1
|
<iframe id="myIframe" src="https://www.example.com"></iframe> |
1 2 3 |
var iframe = document.getElementById('myIframe'); // acquire the iframe element var iframeContent = iframe.contentWindow.document.documentElement.outerHTML; // retrieve the content console.log(iframeContent); // display the whole content in the browser console |
The resulting iframeContent
variable will contain the entire HTML content of the iframe.