Find out if the current window is in an <iframe>. If so, change its URL to "w3schools.com":
The frameElement property returns the <iframe> element in which the current window is inserted.
If the document window is not placed within an <iframe>, the return value of this property is null.
Note: This property will also work for <frame> elements. However, the <frame> element is not supported HTML5.
This property is read-only.
The numbers in the table specify the first browser version that fully supports the property.
Property | |||||
---|---|---|---|---|---|
frameElement | 18.0 | 6.0 | 1.0 | Yes | Yes |
Return Value: | An IFrame object, which is the host of the current window in the parent document, otherwise null |
---|
HTML DOM reference: HTML DOM IFrame Object
HTML reference: HTML <iframe> tag