Skip to content
DevMarDe
Crawl Audit check 87Crawl AuditPerformance

Render-blocking scripts: Crawl Audit check 87

Crawl Audit check 87 looks for scripts in the head without defer or async. How those attributes change loading, what MDN says, and how to add them.

Zain Kazmi2 min read
On this page
Check
87 of 200
Module
Performance & Core Web Vitals
Group
Asset Compression & Optimization
Impact
Medium

Short answer: a plain <script src> in the <head> makes the browser stop, download and run it before reading the rest of the page. Adding defer or async lets the page carry on. Check 87 warns when PageSpeed finds render-blocking scripts, or, without PageSpeed, when a script in the head has neither.

What Crawl Audit checks

  • Full report: PageSpeed's render-blocking result.
  • Free check: scripts in the <head> with a src but no defer, async or type="module". Pass if there are none; warning with the count.

What the standards say

  • MDN: "Scripts without async, defer or type="module" attributes, as well as inline scripts without the type="module" attribute, are fetched and executed immediately before the browser continues to parse the page."
  • defer: "Scripts with the defer attribute will execute in the order in which they appear in the document", after the page is read.
  • async: the script "will be fetched in parallel to parsing and evaluated as soon as it is available."
  • Module scripts (type="module") are deferred by default.
  • MDN is precise about it: "Only script elements in the document's <head> can possibly block rendering." A plain script there blocks the parsing of the page, which holds everything after it up.
<script src="/app.js" defer></script>
<script src="https://example.com/widget.js" async></script>

Which to use

  • defer for your own scripts, which often depend on each other's order.
  • async for independent scripts, such as analytics, that don't care about order.
  • Neither only for the rare script that must run before the page renders, such as one that sets the colour theme to avoid a flash.

Sources

All 200 Crawl Audit checks

See how your site does on every check.

Crawl Audit runs this check and 199 others on your domain. The full report is $7.89, one time. The free check on this site covers 25.