What is the global length variable (window.length)?

前端 未结 2 1513
自闭症患者
自闭症患者 2020-12-19 04:39

I have just observed that every page has length global variable.

What does this variable represent? Is it somehow related to how many iframes/frames are

相关标签:
2条回答
  • 2020-12-19 05:05
    window.length
    

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

    Example

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

    MDN Reference

    Note: No part of this answer comes from me. It all comes from the referred source.

    0 讨论(0)
  • 2020-12-19 05:10

    Yes, it's how many frames (including iframes) are in the current window:

    https://developer.mozilla.org/en-US/docs/Web/API/Window.length

    W3 specification:

    http://www.w3.org/html/wg/drafts/html/master/browsers.html#accessing-other-browsing-contexts

    0 讨论(0)
提交回复
热议问题