Skip to content Skip to sidebar Skip to footer

Eliminate Render-blocking JavaScript And CSS

I am having a trouble with figuring out what 'this spsefic outcome' in Google PageSpeed Test actually mean. I am testing this website: www.loaistudio.com - https://developers.goog

Solution 1:

Your browser freezes page rendering while loading JavaScript

Quick answer: you just have to put your JavaScript src below your content.

Why? Because when your browser begins loading JavaScript, it freezes the rest until it's done with that.

Loading the content of your page first allows it to be displayed, and then JavaScript has all the time it needs to load.

So do like this:

<html>
    <head>
    </head>
    <body>
        My great body content!
        <script type="text/javascript" src="my/js/files.js">
        <script type="text/javascript" src="http://www.googleapi.com/my/external/scripts.js">
    </body>
</html>

Instead of this (which is unfortunately still really common):

<html>
    <head>
        <script type="text/javascript" src="my/js/files.js">
        <script type="text/javascript" src="http://www.googleapi.com/my/external/scripts.js">
    </head>
    <body>
        My great body content!
    </body>
</html>

Post a Comment for "Eliminate Render-blocking JavaScript And CSS"