HTMLIFrameElement: contentDocument property - Web APIs | MDN
Example of contentDocument
js
const iframeDocument = document.querySelector("iframe").contentDocument;
iframeDocument.body.style.backgroundColor = "blue";
// This would turn the iframe blue.
Specifications
| Specification |
|---|
| HTML # dom-iframe-contentdocument |