Is it possible to lazy load a script?

Is it possible to lazy load a script - such that it all happens after the page load proper completes ?

Hi @jbob,

That depends on where the script lives (or needs to live). If it needs to go into the HEAD section, then you won’t be able to lazy load it without building some kind of JavaScript wrapper that does it for you.

If it lives in the BODY section of your page, then you can lazy load it using Raincheck ($15, Weaver’s Space). Drag Raincheck to the spot of the page where you need your script to load, drop the script into Raincheck (using an HTML stack) and set Raincheck to load after the rest of the page has done loading.

Raincheck is the only stack that I know of that allows lazy loading content other than images.

You’ll need to try if your script accepts this though - some might not, and in some cases loading the script after the fact will mess up your page layout (it kind of depends on what the script is there to do - if it needs to draw something, then you might run into these problems). It’s really trial and error I’m afraid.



Great answer Erwin !

It’s for the silly Mailchimp pop-up ( - that the client requires).

Turns out that in some cases it’s slowing PageSpeed significantly.

Seems worth a shot - as you say - and see if it moves me forward.

Many thanks


1 Like