Skip to content

Delay JS ​

"Delay JS" works a bit differently from "defer." When you use delay JS, the JavaScript execution is postponed until after a specific event occurs, in this case when the user interacts with the page (like scrolling, clicking, or typing). This technique ensures that the page loads even faster because the JavaScript doesn't run immediately when the page is loading. Instead, it waits until the user starts engaging with the page.

In Super Page Cache, adding delay JS means the browser loads the page's visible content first, without immediately processing the JavaScript. This can further enhance performance, especially on pages with a lot of scripts, by making the page appear to load almost instantly. The JavaScript is only triggered once the user interacts with the page.

📝 Note: Delay JavaScript is a Super Page Cache Pro feature.

How to enable ​

  1. Go to Super Page Cache > Settings.
  2. Navigate to the Files tab and enable the Delay JavaScript option.
  3. Click Update Settings to save the changes.

You can also exclude JavaScript files or pages from this option by entering the file name or page URL in the settings and saving the changes. Purge the cache after saving all your changes.

Was this helpful?