--- url: "https://web.dev/learn/performance/optimize-resource-loading" titulek: "Optimize resource loading | web.dev" h1: "Optimize resource loading Stay organized with collections Save and categorize content based on your preferences." popis: "As a page loads, many resources are referenced within its HTML that provide a page with its appearance and layout through CSS, as well as its interactivity through JavaScript. In this module, a number of important concepts related to these resources and how they affect a page's load time are covered." jazyk: "en" kanonicka: "https://web.dev/learn/performance/optimize-resource-loading" drobecky: ["web.dev", "Resources", "Performance"] zdroj: "live" wayback_snapshot: "" stazeno: "2026-09-14 00:55:58" znaku: 15546 slov: 2219 kodovani: "iso-8859-2" sha256: "a1442f85b3e87fdf0811036e097022a5b481b2cec88b3c4af592f0cc33fd3f31" --- Optimize resource loading Stay organized with collections Save and categorize content based on your preferences. In the previous module, [some theory behind the critical rendering path](/learn/performance/understanding-the-critical-path) was explored, and how render-blocking and parser-blocking resources can delay a page's initial rendering. Now that you understand some of the theory behind this, you're ready to learn some techniques for optimizing the critical rendering path. As a page loads, many resources are referenced within its HTML that provide a page with its appearance and layout through CSS, as well as its interactivity through JavaScript. In this module, a number of important concepts related to these resources and how they affect a page's load time are covered. Render blocking As was discussed in the [previous module](/learn/performance/understanding-the-critical-path), CSS is a [render-blocking](/articles/critical-rendering-path/render-blocking-css) resource, as it blocks the browser from rendering any content until the [CSS Object Model (CSSOM)](https://developer.mozilla.org/docs/Web/API/CSS_Object_Model) is constructed. The browser blocks rendering to prevent a [Flash of Unstyled Content (FOUC)](https://en.wikipedia.org/wiki/Flash_of_unstyled_content), which is undesirable from a user experience standpoint. In the preceding video, there is a brief FOUC where you can see the page without any styling. Subsequently, all styles are applied once the page's CSS has finished loading from the network, and the unstyled version of the page is immediately replaced with the styled version. Generally speaking, a FOUC is something you don't normally see, but the concept is important to understand so that you know *why* the browser blocks rendering of the page until CSS is downloaded and applied to the page. Render blocking isn't necessarily undesirable, but you do want to minimize how long it lasts by keeping your CSS optimized. Parser blocking A [parser-blocking](/articles/critical-rendering-path/adding-interactivity-with-javascript) resource interrupts the HTML parser, such as a `` When using external JavaScript files (without `async` or `defer`— or `type=module` which is `defer` by default), the parser is blocked from when the file is discovered until it is downloaded, parsed, and executed. When using inline JavaScript, the parser is similarly blocked until the inline script is parsed and executed. The preload scanner The [preload scanner](/articles/preload-scanner) is a browser optimization in the form of a secondary HTML parser that scans the raw HTML response to find and speculatively fetch resources before the primary HTML parser would otherwise discover them. For example, the preload scanner would allow the browser to start downloading a resource specified in an `` element, even when the HTML parser is blocked while fetching and processing resources such as CSS and JavaScript. To take advantage of the preload scanner, critical resources should be included in HTML markup sent by the server. The following resource loading patterns are not discoverable by the preload scanner: Images loaded by CSS using the `background-image` property. These image references are in CSS, and can't be discovered by the preload scanner. Dynamically-loaded scripts in the form of `