Please note, this is a STATIC archive of website developer.mozilla.org from 03 Nov 2016, cach3.com does not collect or store any user information, there is no "phishing" involved.

Revision 982371 of Window.length

  • Revision slug: Web/API/Window/length
  • Revision title: Window.length
  • Revision id: 982371
  • Created:
  • Creator: Delapouite
  • Is current revision? No
  • Comment add links to frame and iframe elements

Revision Content

{{ ApiRef() }}

Summary

Returns the number of frames (either {{HTMLElement("frame")}} or {{HTMLElement("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
}

Specification

Specification Status Comment
{{SpecName('HTML WHATWG','browsers.html#dom-length','Window.length')}} {{Spec2('HTML WHATWG')}}  

Revision Source

<div>{{ ApiRef() }}</div>

<h2 id="Summary" name="Summary">Summary</h2>

<p>Returns the number of frames (either {{HTMLElement("frame")}} or {{HTMLElement("iframe")}} elements) in the window.</p>

<h2 id="Syntax" name="Syntax">Syntax</h2>

<pre class="syntaxbox">
<em>framesCount</em> = window.length;
</pre>

<ul>
 <li><code>framesCount</code> is the number of frames.</li>
</ul>

<h2 id="Example" name="Example">Example</h2>

<pre class="brush:js">
if (window.length) {
  // this is a document with subframes
}</pre>

<h2 id="Specification" name="Specification">Specification</h2>

<table class="spectable standard-table">
 <tbody>
  <tr>
   <th scope="col">Specification</th>
   <th scope="col">Status</th>
   <th scope="col">Comment</th>
  </tr>
  <tr>
   <td>{{SpecName('HTML WHATWG','browsers.html#dom-length','Window.length')}}</td>
   <td>{{Spec2('HTML WHATWG')}}</td>
   <td>&nbsp;</td>
  </tr>
 </tbody>
</table>
Revert to this revision