DOM Document.readyState Property
The readyState property tells you how far the page has loaded: loading, interactive or complete.
Description
The read-only readyState property describes the loading state of the document. It's "loading" while HTML is being parsed, "interactive" once the DOM is ready (just before DOMContentLoaded), and "complete" once images, styles and other resources have loaded (just before the window's load event). The readystatechange event fires when it changes.
Checking it lets a script run its set-up code straight away if the page is already ready, or wait for the event if not.
You can also listen for the readystatechange event on the document to react to each change, although DOMContentLoaded and the window's load event cover most needs. In a script with defer or type="module", readyState is already "interactive" when it runs.
Syntax
document.readyStateValue
"loading" while the page is being parsed, "interactive" once parsing is done, and "complete" when everything has loaded.
Example
Browser Support
The following information will show you the current browser support for the Document.readyState property. Hover over a browser icon to see the version that first introduced support for this property.
Desktop





Tablets & Mobile





