Name

IFrame — an HTML <iframe>

Inherits from

Node, Element

Synopsis

An IFrame object represents an <iframe> element in an HTML document. If you look up an <iframe> using getElementById() or a similar query function, you’ll get an IFrame object. If, however, you access the <iframe> through the frames property of the Window object, or by using the name of the <iframe> as a property of the containing window, the object you obtain is the Window object that the <iframe> represents.

Properties

readonly Document contentDocument

The document contained in this <iframe> element. If the document displayed in the <iframe> is from a different origin, the same-origin policy (The Same-Origin Policy) will prevent access to this document.

readonly Window contentWindow

The Window object of the <iframe>. (The frameElement of that Window object will be a reference back to this IFrame object.)

string height

The height, in CSS pixels, of the <iframe>. This property mirrors the HTML height attribute.

string name

The name of the <iframe>. This property mirrors the HTML name attribute, and its value can be used as the target of Link and Form objects.

readonly DOMSettableTokenList sandbox

This property mirrors the HTML5 sandbox attribute and allows it to be queried and set as a string or as a set of individual tokens.

The sandbox attribute specifies that the browser should impose additional security restrictions on untrusted content displayed in an <iframe>. If the sandbox attribute is present but empty, the <iframe> content ...

Get JavaScript: The Definitive Guide, 6th Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.