Easy Tutorial
❮ Met Nodelist Item Prop Email Maxlength ❯

Window Frames Properties


Example

Modify the src attribute value of the first <iframe> element (index 0):

window.frames[0].location = "https://www.tutorialpro.org/";

Definition and Usage

The frames property returns all named frames in the window.

This collection is an array of Window objects, each representing a frame or <iframe> within the window. The frames.length property holds the number of elements in the frames[] array. Note that the frames referenced in the frames[] array may also include frames, each with their own frames[] array.

Tip: Use frames.length to get the number of frames.

Note: This property can also be used with <frame> elements, but <frame> elements are not supported in HTML5.

This property is read-only.

Browser Support

Property Chrome Edge Firefox Safari Opera
frames Yes Yes Yes Yes Yes

Syntax

window.frames

Technical Details

| Return Value: | Returns a reference to the Window object, representing all frames in the current window. | | --- | --- |


More Examples

Example

Find the number of all frames in the page and then modify the src attribute of the iframe elements to "https://www.tutorialpro.org":

var frames = window.frames;
var i;

for (i = 0; i < frames.length; i++) {
    frames[i].location = "https://www.tutorialpro.org";
}

❮ Met Nodelist Item Prop Email Maxlength ❯