Knowledge baseExam Center
ENEnglish
Choose language13

CKTIS / HTML

blocking: delay rendering for a resource

Distinguish render blocking from HTML parsing and script execution order.

Version: HTML Living Standard

Syntax

<script async blocking="render" src="/gate.js"></script>

The blocking attribute is a space-separated token list on eligible script, stylesheet link and style elements. The currently defined token render requests rendering to wait while the resource is blocking. Placement and each element’s processing rules matter; a script intended to block initial rendering belongs in the document head. This is a performance choice, not a security restriction on code.

Render blocking is different from parser blocking. An external script with async can be fetched without stopping HTML parsing while separately delaying the first render. The attribute does not provide dependency ordering between independent scripts. Adding it indiscriminately can leave the page blank for longer; reserve it for resources that truly must be ready before display.

The local fixture deliberately holds the external script until the DOM has finished parsing. The script then observes no paint entries yet and supplies the result. The test also confirms that a first contentful paint occurs after release. It verifies this controlled Chromium 145 case, not timing guarantees for every network or browser.

Examples

<!doctype html><html><head><meta charset="utf-8">
<script>
window.parserFinished = false;
document.addEventListener('DOMContentLoaded', () => { window.parserFinished = true; });
window.recordGate = () => {
  document.querySelector('#result').textContent = 'parserFinished=' + window.parserFinished + '; paintCountBeforeScript=' + performance.getEntriesByType('paint').length;
};
</script>
<!-- Local server holds this response until DOMContentLoaded, then sends window.recordGate(); -->
<script async blocking="render" src="/gate.js"></script>
</head><body><h1>Content waiting to be painted</h1><output id="result"></output></body></html>

Result

parserFinished=true; paintCountBeforeScript=0

The accompanying fixture server returns the documented one-line script after DOMContentLoaded; it is not an external service.

Sources