is a collection of all of the frames in the current page. It doesn't distinguish between frames and iframes.
It doesn't matter whether there are frames on the page or not, window.frames always exists and points to window.
window.frames === window //true
So to check if there are any frames on the page, use the length property.
Each frame contains another page which has its own global window object. Imagine you have a page with one iframe.
<iframe name="myframe" src="about:blank" />
To get access to the iframe's window, you can do any of these.
Access child properties from parent
We can access properties of the child frame from the parent page
For example, you can reload the frame like this.
Accessing child from parent
From inside the child you can access the parent:
frames.parent === window // true
Using a property called top, you can access the topmost page (the one that contains all the other frames) from within any frame:
window.frames.window.top === window //true
window.frames.window.top === window.top //true
window.frames.window.top === top //true
In addition, self is the same as window.
self === window //true
frames.self == frames.window //true
If a frame has a name attribute, you can also access the frame by name, not only by index.
window.frames['myframe'] === window.frames //true