JavaScript Window frames Tutorial

In this section, we will learn what the window frames property is and how to use it in JavaScript.

JavaScript Window frames Property

This property will return an array-like object that contains all the direct `iframe` elements in the current HTML document.

Basically, we can use this property to access the `iframe` elements on a page.

To access each element in this array like object, we can use the same syntax that we used for arrays!

For example, this is the way to get the first element of such an object (let’s say the name of the object is “frames”):

frames[0];

This is the same as if we’ve used the “getElementsByTagName()” method.

For example:

document.getElementsByTagName(“iframe”)[0];

Window frames Property Syntax:

window.frames;

Example: using JavaScript Window frames Property

See the Pen using JavaScript Window frames Prope by Omid Dehghan (@odchan1) on CodePen.

Leave a Reply