Nuestros voluntarios aún no han traducido este artículo al Español. ¡Únete a nosotros y ayúdanos a traducirlo!
También puedes leer el artículo en English (US).

If the iframe and the iframe's parent document are Same Origin, returns a Document (that is, the active document in the inline frame's nested browsing context), else returns null.

Example of contentDocument

var iframeDocument = document.getElementsByTagName("iframe")[0].contentDocument; 

iframeDocument.body.style.backgroundColor = "blue";
// This would turn the iframe blue.

Specifications

Specification Status Comment
HTML Living Standard
The definition of 'HTMLIFrameElement: contentDocument' in that specification.
Living Standard  

Browser compatibility

Update compatibility data on GitHub
DesktopMobile
ChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidFirefox for AndroidOpera for AndroidSafari on iOSSamsung Internet
contentDocumentChrome Full support 43Edge Full support 12Firefox Full support YesIE Full support 8Opera Full support YesSafari Full support 10WebView Android Full support YesChrome Android Full support YesFirefox Android Full support 4Opera Android Full support YesSafari iOS Full support YesSamsung Internet Android ?

Legend

Full support  
Full support
Compatibility unknown  
Compatibility unknown

Etiquetas y colaboradores del documento

Colaboradores en esta página: tomayac, mdnwebdocs-bot, zhuangyin, sideshowbarker, fscholz, ryanpcmcquen
Última actualización por: tomayac,