Remove Render-Blocking JavaScripts

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
8 years ago
I will give it a try, following my approach above and let you know ASAP!

See you.
8 years ago
Hey All,

I just wanted to thank you guys for tracking this down. I have run into the same issues but I just haven't had the time to track it down. Kudos to you all!

Kevin
8 years ago
any final solution?
8 years ago
dianoche wrote:
any final solution?

Still improving. Got it working 95%, but running into the issue now that some libraries that depend on jquery don't work sometimes (e.g. nivoslider).
As ALL libraries are loaded async, the nivoslider may load BEFORE jquery....
So, I change the JS to load jquery first, and THEN all the other resources, but the same error occurs. Used
head.load('jquery', function() { head.load(all_other_scripts);});

Besides that, jquery is working fine for inline scripts, the rest is working, but these errors are quite random.

It will be cool if someone else is investigating this solution too, so we are working on it together.
8 years ago
Oh, some inline scripts are defined just with <script> (instead of <script type=text/javascript>), so I had to find-replace another ~200 occurrences...

~500 occurrences of inline script :S
8 years ago
i was guessing the widgets may create some problems :) so they are. you can replace the nivo with nice responsive bs-carousel :)) and how did you change the @Html.AppendScriptParts calls? I am trying a create non-profit gift & donation registry website and stuck/got lost in cart:( so didn't have too much time to focus on this
8 years ago
Hi eurodress

I would just make sure jQuery.js is left in the head, and things like the jquery.nivo.js are put in the footer as it is not essential for layout rendering.
8 years ago
dianoche wrote:
i was guessing the widgets may create some problems :) so they are. you can replace the nivo with nice responsive bs-carousel :)) and how did you change the @Html.AppendScriptParts calls? I am trying a create non-profit gift & donation registry website and stuck/got lost in cart:( so didn't have too much time to focus on this

Yeah, I'm removing nivoslider now, but next error I got was with autocomplete... Not every time though.
So, any jquery addin may cause errors.

I did not change any @Html.AppendScripts calls.
I replaced the GenerateScripts() method. Instead of rendering <Script> tags, I render the required js to defer load them. See my earlier post.

Will post the code when it's ready.
8 years ago
Then when you are done we can use the same method for Removing Render-Blocking CSS too :)
8 years ago
XtremeCommerce wrote:
Hi eurodress

I would just make sure jQuery.js is left in the head, and things like the jquery.nivo.js are put in the footer as it is not essential for layout rendering.

Sorry but please read previous posts. Your approach is not deferring anything.
Please read my approach...

Just FYI all, PageSpeed (Chrome addin) now passes the rule "Defer loading of JS" :)
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.