How to eliminate javascript rendering

I tested the web-page loading by using the Google PageSpeed tool . The result says: “Eliminate JavaScript and CSS visualization blocking in superscript content” for

<script type='text/javascript' src='http://example.com/wp-includes/js/jquery/jquery.js?ver=1.11.2'></script>
<script type='text/javascript' src='http://example.com/wp-includes/js/jquery/jquery-migrate.min.js?ver=1.2.1'></script>

Source:

<head>
...
...

<script>(function(){document.documentElement.className='js'})();</script>
...
...
</head>

I want to add an async or defer tag. How can I achieve this?

+4
source share
1 answer

From MDN about async attribute:

It does not affect embedded scripts (i.e. scripts that do not have the src attribute).

The same goes for the defer attribute.

Basically, if you really want to get rid of the error, just move it immediately before the tag </body>.

0
source

Source: https://habr.com/ru/post/1599551/


All Articles