Skip to main content

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

SettingTypeDefaultWhat it does
Delay JavaScript until interactionToggleOffHold eligible scripts until interaction or timeout
Timeout (seconds)Number5Load delayed scripts after this many seconds if there is no interaction. 0 = interaction only. Range 0–30
ExclusionsTextjQuery + Divi Engine keywordsOne 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) and es6-promise stay immediate so required checkboxes and spam protection can run.

When to use it

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.

What's Next