Delay JavaScript
What it does
Delay JavaScript waits to run many front-end scripts until the visitor interacts with the page (scroll, click, keypress, or touch) or a timeout passes. That can improve early load metrics, but it is also one of the most common reasons a site looks broken after enabling performance tools.
The Visual Builder, previews, and WooCommerce cart / checkout / account pages are never delayed.
Where to find it
Divi Engine → Nitro Settings → Scripts & CSS → Delay JavaScript
Settings
| Setting | Type | Default | What it does |
|---|---|---|---|
| Delay JavaScript until interaction | Toggle | Off | Hold eligible scripts until interaction or timeout |
| Timeout (seconds) | Number | 5 | Load delayed scripts after this many seconds if there is no interaction. 0 = interaction only. Range 0–30 |
| Exclusions | Text | jQuery + Divi Engine keywords | One handle or URL keyword per line. Matching scripts load immediately. If Minify combines scripts, delay applies to the combined file — exclude nitro- / nitro_cache to keep that bundle immediate |
Default exclusion keywords include jquery-core, jquery, jquery-migrate, and Divi Engine prefixes (Form Builder, Ajax Filter, Machine, BodyCommerce, Mega Menu, Membership, Protect, Nitro).
Always immediate
- Google reCAPTCHA scripts always load immediately.
- On pages with a native Divi Contact Form, Divi’s front-end form script (
divi-custom-script) andes6-promisestay immediate so required checkboxes and spam protection can run.
When to use it
- After a Safe or Balanced preset is stable
- When another plugin is not already delaying JavaScript
When to turn it off
- Menus, sliders, filters, forms, or chat widgets only work after a click/scroll
- First step in Nitro broke my site
warning
Do not enable Delay JavaScript in Nitro and in LiteSpeed / WP Rocket at the same time.