Removing unused JavaScript in Webflow helps reduce page weight and improve metrics like Time to Interactive (TTI). Webflow doesn’t provide full control over core scripts, but you can minimize third-party and unused custom code.
1. Audit Third-Party Scripts
- Identify all third-party JS scripts (e.g., analytics tools, widgets, live chat) in your Page Settings, Site Settings, or inside Embed blocks.
- Use Google PageSpeed Insights or Lighthouse to see which scripts are unused or delaying interactivity.
- Remove scripts that are no longer active or necessary.
- Consider loading third-party scripts conditionally using JavaScript only when needed (e.g., after user interaction).
2. Avoid Heavy Webflow Components
- Webflow Interactions (IX2) automatically load interaction libraries sitewide, even if used on a single page.
- To reduce unused JS, minimize the use of Interactions on unused pages, or create separate Webflow projects/sites for different sections (if needed).
3. Minimize Custom Code
- Go to Page Settings > Custom Code and Site Settings > Custom Code and review any inline or linked JavaScript.
- Delete unused functions or libraries (like jQuery plugins or animations) that are no longer being used.
- Move inline or third-party JavaScript to the bottom of the body (
before </body>
section) to delay execution for improved TTI.
4. Use Webflow’s Native Features Over Plugins
- Replace JavaScript-based sliders, counters, reveals, and tabs with Webflow-native components whenever possible.
- This reduces the need for custom JS or libraries like jQuery UI or GSAP, unless necessary.
5. Defer or Lazy Load Where Possible
- Most custom scripts inserted in Webflow can be modified to defer execution. Add the attribute defer to external scripts (e.g.,
<script defer src="...">
) when embedding. - For third-party content like iframes and widgets, ensure lazy loading (e.g., using
loading="lazy"
) is applied.
6. Disable Webflow’s jQuery if Not Needed
- Webflow includes jQuery by default. If you're not using any jQuery-dependent widgets or scripts:
- Contact Webflow Support to explore options or submit a feature request to disable jQuery in your build.
7. Use a CDN Script Manager or Tag Manager
- Tools like Cloudflare Zaraz, Partytown, or Google Tag Manager can help isolate third-party JavaScript off the main thread, reducing their TTI impact.
- Partytown, in particular, allows you to run non-essential scripts in a Web Worker.
Summary
To reduce unused JavaScript in Webflow, audit and remove unnecessary third-party scripts, avoid unused interactions, replace custom code with native features, defer JavaScript execution, and consider tools like Cloudflare Zaraz or Partytown. While you can't fully eliminate core Webflow scripts, these steps significantly improve Time to Interactive.