Defer Parsing of Javascript

Hello, I am using Google Developers PageSpeed Insights and I am running the test on one of my pages. and it says that: 346.5KiB of JavaScript is parsed during initial page load. Defer parsing JavaScript to reduce blocking of page rendering. and gives me this list. (85.7KiB) (84.5KiB) (83.7KiB) (63.2KiB) (26.4KiB) (1.6KiB) (824B of inline JavaScript) (471B)

Not sure what “Defer Parsing” means?

Defer is an attribute of html script tag. It delays the execution of the script tag until after the page has loaded. The reference literature is here.

For your reference, here is a good article " How To Increase The Page Loading Speed Of Your Mobile Website Design." on the tactics to increase your page loading speed. The defer tactic is point # 7 in the article.

Good luck,


1 Like

Are your scripts attached to the bottom of the page (just before the closing </body> tag? That seems the best way to defer script loading to me. Not sure if that’s what the issue is, though.


One of our lessons learned was that in spite of the scripts being @ the bottom of the page. The section of the website that is above the fold that requires the javascript will quit rendering until the javascript loads. So best of both worlds, put the scripts at the bottom of the page and add defer as required if pagespeed insights detects it.

This worked for us on customer pagespeed insight improvements.



Thanks Guys, @websitemedia @ralphm

I got these script tags that is telling me defer, however I have no control over them since they are from outside sources beyond my server. should I just place them at the bottom of my </body>?

<script type="text/javascript" src=""></script>
<script type="text/javascript" src=""></script>
 <script type="text/javascript" src=""></script>

Yes, although make sure any other scripts that depend on them are placed below them. For example, you need to call the jQuery library before linking to other scripts that depend on it.

1 Like

Like So?:

<script type="text/javascript" src=""></script>
    <script type="text/javascript" src=""></script>
    <script type="text/javascript" src=""></script>
      (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),

      ga('create', 'UA-57297790-1', 'auto');
      ga('send', 'pageview');
    <script src="/Scripts/jquery-1.4.1.min_defer.js" type="text/javascript"></script>     
      <!-- Shock label Calc Scripts -->
    <script type="text/javascript" src="/calc/js/jquery_defer.js"></script>
    <script type="text/javascript" src="/calc/js/jquery-ui.min.js"></script>
    <script type="text/javascript" src="/calc/calc_defer.js"></script>
    <script type='text/javascript'>
        var _glc =_glc || []; _glc.push('all_ag9zfmNsaWNrZGVza2NoYXRyDwsSBXVzZXJzGLSQ6bwKDA');
        var glcpath = (('https:' == document.location.protocol) ? '' : 
        var glcp = (('https:' == document.location.protocol) ? 'https://' : 'http://');
        var glcspt = document.createElement('script'); glcspt.type = 'text/javascript'; 
        glcspt.async = true; glcspt.src = glcpath + 'livechat-new.js';
        var s = document.getElementsByTagName('script')[0];s.parentNode.insertBefore(glcspt, s);

Hm, I suppose so. There are lots of things in there I don’t know about. Seems like a lot of defer scripts in there, though. What are they all for? If you are looking at optimizing page speed load, my guess would be the best thing you could do is get rid of a lot of those scripts altogether. :stuck_out_tongue: (Partly tonge-in-cheek, as I don’t know what the purpose of all those scripts is.)

they are for a calculator in the website.I cannot get rid of them ha…

hmm seems I didnt need these two hehe :grin:

<script type="text/javascript" src=""></script>
 <script type="text/javascript" src=""></script>

but I need this one because it seems like my nav is using some sort of jquery

<script type="text/javascript" src=""></script>

Is it bad that its telling to defer alot?

I assume there’s a purpose for it. I was more wondering if there’s redundancy creeping in there—such as duplication.

Calling in more than one version of jQuery is likely to cause problems eg.
whichever `jquery.min.js’ is referenced last is likely to override functions in the previous one.

Might not be a problem, but it depends on what version other functions are dependent on.

but should be fixed regardless.

1 Like

Is it ok to put this google analytics code before my </body>?

<script type="text/javascript">
  var _gaq = _gaq || [];
  _gaq.push(['_setAccount', 'UA-41887506-1']);

  (function() {
    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '';
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);


Yes, that’s where you should be putting it.

But should it be right before the </body>? like the last thing?

Just a general question I tested big company and design firm websites and they have very low scores on their websites using PageInsights. My question is am I wasting my time on working on this, because it seems nobody else uses it? Maybe it depends on the content being used?

Big companies don’t need to be good. But the average Joe Schmo needs every inch of ground they can gain.

That said. it is possible to lose focus by over-optimizing. i.e.
Is it really worth spending time trying to save .000000058 ms or 3 bytes?