Does anyone know how to get the HTML out of an IFRAME I have tried several different ways:
document.getElementById(\'iframe01\').contentDocument.body.innerHT
You can use the contentDocument or contentWindow property for that purpose. Here is the sample code.
function gethtml() {
const x = document.getElementById("myframe")
const y = x.contentWindow || x.contentDocument
const z = y.document ? y.document : y
alert(z.body.innerHTML)
}
here, myframe
is the id of your iframe.
Note: You can't extract the content out of an iframe from a src outside you domain.