Get Text from iframe
19,282
Assuming your iframe is in the same domain as your HTML:
var myIFrame = document.getElementById("myIframe");
var content = myIFrame.contentWindow.document.body.innerHTML;
Otherwise you'll face some Same Origin Policy issues.
Comments
-
Rhs almost 2 years
I have the following HTML
<iframe id ="myIframe"> #document <head>...</head> <body>Text I want to get is here</body> </iframe>
I only know the iframe's id. Using JavaScript, how can I extract the text from the body?