Using PageSpeed to eliminate render-blocking JavaScript for jQuery

Yahya Uddin picture Yahya Uddin · Apr 25, 2016 · Viewed 24.8k times · Source

I have jQuery added at the bottom of the page. However, when I run my site on pagespeed insights (Mobile), I get the error:

Eliminate render-blocking JavaScript and CSS in above-the-fold content Your page has 2 blocking script resources and 1 blocking CSS resources.

This causes a delay in rendering your page. None of the above-the-fold content on your page could be rendered without waiting for the following resources to load.

Try to defer or asynchronously load blocking resources, or inline the critical portions of those resources directly in the HTML.

See: http://learnyourbubble.com and https://developers.google.com/speed/pagespeed/insights/?url=http%3A%2F%2Flearnyourbubble.com&tab=mobile

However, the jQuery is added at the bottom of the page. So it should be below the fold.

How can I remove this error?

Answer

Misunderstood picture Misunderstood · May 10, 2016

It has to do with your font files.

Look at request 19 and 20 in the waterfall. These font files are considered CSS.

Notice how first paint (green vertical line) does not happen until after the font files are loaded?

Then notice the 15 JS files were loaded prrior to the font (CSS) files.

That is what Google is taking about.

Having 16 JS files is beyond excessive.

Try this: Disable JavaScript in your Browser. Notice the only change is in the menu header. Is 16 JS files worth that? I think not.

enter image description here