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

Browser compatibility

Help improve MDN

Learn how to contribute

This page was last modified on by MDN contributors.