English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

Window frames property

JavaScript Window Object

framesA read-only property returns an object similar to an array, representing all <iframe> elements in the current window.

You can access each <iframe> element using an index number, and the index starts from 0.

Usageframes.lengthReturns the number of frames in the current window (including IFRAMES).

Note:This property also applies to <frame> elements. However, HTML5Does not support <frame> element.

Syntax:

window.frames
var fr = window.frames;
fr[0].location = "https:"//www.oldtoolbag.com/css-reference/";
Test See‹/›

Browser Compatibility

All browsers fully support the frames property:

Property
framesYesYesYesYesYes

Technical Details

Return Value:Returns a reference to the window object representing the number of all frames in the current window

More Examples

Traverse all frames and change the location of all frames:

var list = ["/tags/", "/css-reference/", "/jsref/", "/bootstrap/];
var fm = window.frames;
  
for (let i = 0; i < fm.length;++) {
fm[i].location = list[i];  
}
Test See‹/›

Related References

Window (Window) Reference:window.frameElement Property

Window (Window) Reference:window.parent Property

Tag Reference:HTML <iframe> Tag

JavaScript Window Object