Remove unused javascript to improve performance

Is there a way to remove unused javascript and css to optimize performance? I use google lighthouse to inspect the performance of my page. The desktop scores are pretty good but the mobile score for performance is pretty low. Any recommendations or suggestions?


Hi, @KD_web

Unused JavaScript can significantly impact page performance, especially on mobile devices. Removing or deferring scripts that aren’t essential for the initial render can improve load times, reduce main-thread work, and enhance Core Web Vitals. Here are some practical steps you can take in Webflow:

  • Audit scripts and embeds
    Review all custom code, third-party integrations, and widget embeds. Identify scripts that aren’t needed on every page, such as analytics snippets, chat widgets, or marketing tools.

  • Load scripts conditionally
    Only include JavaScript on the pages where it is required. For example, product scripts or form validators may not be needed on the homepage.

  • Defer non-critical JavaScript
    Use the defer attribute to postpone execution until after the HTML has been parsed:

  • Remove unused third-party embeds
    Some widgets load large scripts even if they’re not actively used. Consider replacing them with lighter alternatives or only loading them on interaction

Alternatively, if you prefer not to manually audit scripts, a third-party performance tool like Website Speedy can help identify heavy or unused assets and suggest optimizations.

Disclosure : We are the developer of Website Speedy and happy to help you !