Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

HTML DOM Frame/IFrame contentDocument property

Frame/IFrame contentDocument property

Frame/IFrame Object Reference Frame/IFrame Object


Definition and Usage

The contentDocument property returns the document contained in the frame as an HTML object.

The returned object can be processed using all standard DOM methods.

**Note:** For security reasons, the content of the document can only be accessed by another document under the same domain name.

Syntax

frameObject.contentDocument

or

iframeObject.contentDocument


Browser support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

All major browsers support the contentDocument property

**Note:** If !DOCTYPE is specified, Internet Explorer 8 and later versions support the contentDocument property; for other IE versions, please use contentWindow attribute.


Example

Example

The browser example demonstrates how to modify the background color of the document in an iframe:

Runoob Tutorial(runoob.com)

    



Try it »


Frame/IFrame Object Reference Frame/IFrame Object