What exactly does "contentDocument" represent for an iframe (or even the old "frame" element)? Is it equivalent to the "html" element or the "body" element ? What is it's use? And is this property supported across all the browsers?
The contentWindow property returns the Window object of an HTMLIFrameElement. You can use this Window object to access the iframe's document and its internal DOM.
contentWindow. document. body. innerHTML: It returns the HTML content of iframe body.
contents() can get both text nodes and HTML elements. That's why one can get document contents of an iframe by using it. Note that the iframe and page have to be on the same domain.
</i>'); // use this to write something into the iFrame window.
contentDocument
represents the document of an iframe (DOM object). It is not equivalent to html
since documents have their own properties, however if you type:
myFrame.contentDocument.body
You will get the body itself.
It is supported in all the browsers, with a tiny modification: for Internet Explorer use
myFrame.contentWindow.document
Enjoy, Nili
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With