Window.length

Returns the number of frames (either <frame> or <iframe> elements) in the window.

Syntax

framesCount = window.length;
  • framesCount is the number of frames.

Example

if (window.length) {
  // this is a document with subframes
}

Specifications

Specification Status Comment
HTML Living Standard
The definition of 'Window.length' in that specification.
Living Standard
HTML5
The definition of 'Window.length' in that specification.
Recommendation

Browser compatibility

Update compatibility data on GitHub
DesktopMobile
ChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidFirefox for AndroidOpera for AndroidSafari on iOSSamsung Internet
lengthChrome Full support 1Edge Full support 12Firefox Full support 1IE Full support 4Opera Full support ‚ȧ12.1Safari Full support 1WebView Android Full support 1Chrome Android Full support 18Firefox Android Full support 4Opera Android Full support ‚ȧ12.1Safari iOS Full support 1Samsung Internet Android Full support 1.0

Legend

Full support  
Full support