Disable scripts from loading in designer?

Is there a way to disable a certain script from loading in the Webflow designer? I have a script that loads embedded forums and commenting across my site. I’ve noticed that it slows the designer up quite a bit.

Is there a way to set it to only launch on the staging and live sites and NOT in the designer? Thanks!

Pretty sure custom scripts don’t run in the designer. If you have a code embed on the page with CSS then that will take effect on the page, but not JavaScript.

In any case, wrap your JavaScript in a window.onload event and it will only run on page load.

Ahh good point. I should have clarified. I meant that I don’t want certain embeds loading. In this case, I have a bunch of iframes throughout the site. Can window.onload be used with iframes too?

@jasondark, I think he’s referring to iframes, which indeed load inside the designer.

You can do what you suggested, use javascript to add those elements to the page only when the DOM is ready. With jQuery it would be something like

$(()=>$(".container").html("html for the embed here"))

Thanks @jasondark and @Jeandcc. I think I found a simpler solution. You can just add an empty script tag in the same HTML embed as the iframe and webflow won’t load it in the designer.

HA! That’s clever, good job!