Defer parsing of Javascript


#1

Hello.

If I launch an analysis using GTMETRIX the tools is always telling that I have to Defer parsing of Javascript to improve my web performance. You can take a look if you launch an analisys for this URL

However in my cloudflare settings I have enable rocket Loader that should fix that issue.

Could you tell me why it is not working?

Thanks in advance!


#2

Hi @victor4,

Looking at your code with Rocket Loader enabled, I can see that our JS is inserted just before the body tag:

<script src="https://ajax.cloudflare.com/cdn-cgi/scripts/4f936b58/cloudflare-static/rocket-loader.min.js" data-cf-nonce="f7e49e31e18dd3e2e0899602-"></script>
<body oncontextmenu="return false;" class="post-template-default single single-post postid-55414 single-format-standard woocommerce-no-js tve-woo-minicart">

This is what is causing GTMetrix to see Rocket Loader as render blocking. The inline event oncontextmenu="return false;" that you have applied to the body tag is causing Rocket Loader to need to execute earlier here. If you remove that, Rocket Loader will only be inserted at the bottom of your page and you’ll see performance improve.

Additionally, it’s bad for usability to disable the context menu - so I would recommend removing oncontextmenu="return false;" regardless, here.


#3

Hi Simon!!

Thanks a lot for your answer. I will carry out the change you suggested to me.

I would like to ask another question. Do you know how the code oncontextmenu=“return false;” was added to my website?

Thanks a lot for your help!!


#4

No problem!

As you are using Wordpress the most likely culprit is a plugin you have installed / enabled, or the theme you have chosen. I would start by checking the settings of those or disabling each one by one if you’re unsure what is placing that code.


#5

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.