Skip to main content

Delay All JavaScript

Updated over a week ago

FlyingPress delays non-critical JavaScript from themes, plugins, or inline code to reduce render-blocking and improve Core Web Vitals like LCP and TTI.

How it works

You can choose between three strategies:

  1. Defer loading: Uses the browser’s native defer attribute. Scripts are downloaded in the background and executed in order after the HTML is parsed, without blocking page rendering. Executes faster — ideal if your site relies heavily on JavaScript-based elements or interactions.

  2. Load when idle: Scripts run one by one when the browser becomes idle after loading important content. Recommended if your site is not JS-heavy and above-the-fold content doesn’t depend on JavaScript.

  3. Load after interaction: Scripts load only after the user scrolls, clicks, or interacts with the page. Use with caution — not suitable if your site has sliders, animations, menus, or other interactive elements in the above-the-fold area.

All scripts are delayed unless excluded.

Excluding scripts

FlyingPress checks the full <script> tag—src, id, and inline content.
You can exclude a script by entering any partial keyword.

✅ Matching is partial and case-insensitive
Wildcards are not supported (e.g. *slider* won’t work—just use slider)

Examples

✅ External plugin script

<script src="https://example.com/wp-content/plugins/contact-form-7/includes/js/index.js"></script>

Any one of these will exclude it:

contact-form-7
index.js
/wp-content/plugins/

✅ External theme script

<script id="theme-scripts" src="https://example.com/wp-content/themes/astra/js/navigation.js"></script>

Exclude with:

theme-scripts
astra
navigation.js
/wp-content/themes/

✅ Inline script

<script>
window.myChat = { id: 'abc' };
initMyChatWidget();
</script>

Exclude using:

myChat
initMyChatWidget

Tips

  • To exclude all plugin scripts: /wp-content/plugins/

  • To exclude all theme scripts: /wp-content/themes/

  • For inline scripts, use function names or variable names

  • Always test key functionality (menus, sliders, forms) after enabling delay

Did this answer your question?