HTMLIFrameElement.contentDocument
Baseline Widely available
This feature is well established and works across many devices and browser versions. It’s been available across browsers since July 2015.
Si l'iframe et le document parent de l'iframe sont de la même origine, HTMLIFrameElement.contentDocument
retourne un Document
(c'est à dire le document actif dans le contexte de navigation imbriqué du cadre). Sinon, il retourne null
.
Exemples
js
var iframeDocument = document.getElementsByTagName("iframe")[0].contentDocument;
iframeDocument.body.style.backgroundColor = "blue";
// Cela passe la couleur d'arrière-plan de l'iframe en bleu.
Spécifications
Specification |
---|
HTML # dom-iframe-contentdocument |
Compatibilité des navigateurs
Report problems with this compatibility data on GitHubdesktop | mobile | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
contentDocument |
Legend
Tip: you can click/tap on a cell for more information.
- Full support
- Full support
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.