Where to insert rocket loader ignore code


It’s been said that I should add this code " <script data-cfasync=“false” src="/javascript.js"" into my html in order to ignore rocket loader for a specific JS.
I want to do this for google searchform. but it’s a little bit different and when I add above code the search box disappears.
Here’s what I do:

<script (function() { var cx = '007478810016489741469:vy3gvdesivs'; var gcse = document.createElement('script'); gcse.type = 'text/javascript'; gcse.async = true; **data-cfasync=false;** gcse.src = 'https://cse.google.com/cse.js?cx=' + cx; var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(gcse, s); })();


What possibly could be the problem?

1 Like

I’m also having this issue - and the rocket loader seems to prevent the async script from loading properly. Please someone help with this.

Shouldn’t the data-cfasync=false go right after the opening script tag? So you’d end up with:

<script data-cfasync=“false” blahblahblah>

So now Rocket Loader is going to ignore everything inside <script …>.

That makes sense! I was really tired when working on it. I’m making the change now.

Yes that did the trick!!

1 Like

This topic was automatically closed after 14 days. New replies are no longer allowed.