HTMLIFrameElement: contentDocument property
MDN Web Docs · نسخهٔ df622a2a1c1e · CC BY-SA 2.5 و مجوز جداگانهٔ ناشر برای نمونهکد
{{APIRef("HTML DOM")}}
The **contentDocument** read-only property of the {{domxref("HTMLIFrameElement")}} interface returns a [Document](/en-US/docs/Web/API/Document) (that is, the active document in the inline frame's nested browsing context) if the iframe and the iframe's parent document are Same Origin, else returns null.
Example of contentDocument
js
const iframeDocument = document.querySelector("iframe").contentDocument;
iframeDocument.body.style.backgroundColor = "blue";
// This would turn the iframe blue.Specifications
{{Specifications}}
Browser compatibility
{{Compat}}