mozilla
Your Search Results

    Document.readyState

    This article is in need of a technical review.

    Summary

    Returns "loading" while the document is loading, "interactive" once it is finished parsing but still loading sub-resources, and "complete" once it has loaded.

    The readystatechange event fires on the document object when this value changes.

    Syntax

    var string = document.readyState;
    

    Examples

    // alternative to DOMContentLoaded
    document.onreadystatechange = function () {
      if (document.readyState == "interactive") {
        initApplication();
      }
    }
    // alternative to load event
    document.onreadystatechange = function () {
      if (document.readyState == "complete") {
        initApplication();
      }
    }

    Specification

    See also