The contentWindow
property returns the Window object of an <iframe> element. You can use this Window
object to access the iframe's document and its internal DOM. This attribute is read-only, but its properties can be manipulated like the global Window
object.
Example of contentWindow
var iframe = document.getElementsByTagName("iframe")[0]; var x = iframe.contentWindow; if (x.document) { x = iframe.document; // to ensure compability } x.body.style.backgroundColor = "blue"; // this would turn the iframe blue.