What is HTML Script Loading Strategy Builder?
How a script loads affects page performance and script execution order. A normal script blocks HTML parsing. defer downloads in parallel and executes after HTML parsing. async downloads in parallel and executes as soon as it is ready. type='module' scripts are deferred by default. Choosing the right strategy depends on whether the script is critical, depends on other scripts, or is independent.
Quick answer
Choose a script loading strategy based on when the script must execute. Use defer for scripts that need the full DOM but can download in parallel. Use async for independent scripts like analytics. Use type='module' for modern ES module code.
Limitations
- defer preserves script execution order; async does not. Choose based on whether script order matters.
- async scripts execute as soon as they finish downloading, which can block rendering if the script is large.
- type='module' scripts are deferred by default and do not need an additional defer attribute.
How to use this tool
- Select the script type that matches your use case.
- Enter the script URL.
- The tool recommends the best loading attribute.
- Copy the script tag with the correct attributes.
What you can use it for
- Add a deferred application bundle that runs after the page parses.
- Include an async analytics script that loads independently.
- Set up a module script for a Vite or Astro entry point.