Glossary
DOMContentLoaded
The first moment the document is complete — which is not the moment the page is.
By Roger Campos · Last updated: September 2026
TL;DR
DOMContentLoaded is the browser event that fires once the HTML document has been fully parsed and its deferred scripts have run, without waiting for images, stylesheets that block nothing, or iframes. It comes before the load event, and on a client-rendered page it fires long before the content exists.
Free plan, no credit card. 1,000 credits a month.
How it works
Where it sits in a page load
- 1The browser receives the HTML and starts parsing. Classic
<script>tags pause the parser while they download and run. - 2Parsing ends. Scripts marked
deferrun, in order. - 3DOMContentLoaded fires on
document. The DOM tree is complete. - 4Images, iframes and other subresources finish. load fires on
window. - 5The page's own JavaScript carries on: API calls, lazy content, analytics. Tools that wait for the network to go quiet wait for this.
async scripts are not waited for — they run whenever they arrive, before or after the event. Code that needs the DOM listens for it:
document.addEventListener("DOMContentLoaded", () => {
document.querySelector("#year").textContent = new Date().getFullYear();
});In practice
What it means when you fetch pages
For a server-rendered page, the DOM at DOMContentLoaded already holds the text, so reading it there is fast and complete. For a client-rendered page it holds the empty shell, because the scripts that build the content have only just started. Automation tools offer it as a wait option (waitUntil: "domcontentloaded") for speed; it is the wrong default for reading content.
It matters for errors too. A script that throws during parsing throws before DOMContentLoaded; a failed API call throws seconds after load. Capture only up to the event and you miss most of what goes wrong.
URLpipe
URLpipe
URLpipe reads pages after load and after the network settles (see networkidle), not at DOMContentLoaded. /console listens from the start of the load until then, and then a little longer, so errors raised by late scripts are in the result.
Try it
DOMContentLoaded, on a page you choose
Related terms
FAQ
Frequently asked questions
What is the difference between DOMContentLoaded and load?
Does DOMContentLoaded wait for CSS?
Is DOMContentLoaded the same as jQuery's ready?
See it on your own pages.
Free plan, no card. Confirm your email and your API key is live — you'll be making real requests in minutes.