Delay JavaScript

Since version 2.0, SWIS includes the ability to delay execution of JS until user interaction. That is, until your visitor scrolls, moves their mouse over your page, taps their touch screen, etc.

Because delaying JS is prone to cause problems and because it's a great way to cheat speed tests without improving the experience for actual visitors, SWIS doesn't have a global setting to delay ALL JavaScript.

Instead, SWIS gives you super powers, to pick and choose which JS should be delayed. Using our Slim rules engine for fine-grained control, SWIS even lets you choose to delay a JS asset everywhere, or only on select pages. So head on over to the front-end of your site, look for the SWIS menu in the admin bar, and click Manage JS/CSS (we call it Slim).

Start with your home page, and as you add JS delay rules, always test to be sure nothing is broken. As with JS defer (optimized loading), the Manage JS/CSS (Slim) panel will alert you to any errors after you add a rule and refresh the page. Once you're happy with the home page, it's a good idea to check a few other pages, since the JS in effect can vary from page to page.

You can also use Test Mode to restrict all JS/CSS optimizations to logged-in admins. This way, nothing you do will affect your visitors, and you can feel free to experiment all you like until you have things just the way you want them. When you're ready, you can disable Test Mode and unleash your new and leaner site for your visitors.

Still need help? Contact Us Contact Us