Title: [Plugin: W3 Total Cache] Defer JavaScript Parsing
Last modified: August 20, 2016

---

# [Plugin: W3 Total Cache] Defer JavaScript Parsing

 *  [Dusibello](https://wordpress.org/support/users/dusibello/)
 * (@dusibello)
 * [14 years, 4 months ago](https://wordpress.org/support/topic/plugin-w3-total-cache-defer-javascript-parsing/)
 * Absolutely brilliant work on this plugin. Has done WONDERS for my Google Page
   Speed rating.
 * One issue GPS recommends work on is the following: Defer parsing JavaScript to
   reduce blocking of page rendering.
 * Not sure of where and how to do that in W3TC settings.
 * [http://wordpress.org/extend/plugins/w3-total-cache/](http://wordpress.org/extend/plugins/w3-total-cache/)

Viewing 15 replies - 1 through 15 (of 24 total)

1 [2](https://wordpress.org/support/topic/plugin-w3-total-cache-defer-javascript-parsing/page/2/?output_format=md)
[→](https://wordpress.org/support/topic/plugin-w3-total-cache-defer-javascript-parsing/page/2/?output_format=md)

 *  [Pothi Kalimuthu](https://wordpress.org/support/users/pothi/)
 * (@pothi)
 * [14 years, 4 months ago](https://wordpress.org/support/topic/plugin-w3-total-cache-defer-javascript-parsing/#post-2508616)
 * There is no W3TC settings to do this.
 * There are a lot of tips available to do it manually when I searched the term “
   Defer parsing JavaScript to reduce blocking of page rendering” in Google.
 *  Thread Starter [Dusibello](https://wordpress.org/support/users/dusibello/)
 * (@dusibello)
 * [14 years, 4 months ago](https://wordpress.org/support/topic/plugin-w3-total-cache-defer-javascript-parsing/#post-2508652)
 * Thanks Pothi – Yeah, before trying all those ‘manual’ options I wanted to be 
   sure I was not missing a setting in W3TC.
 * Cheers
 *  Plugin Contributor [Frederick Townes](https://wordpress.org/support/users/fredericktownes/)
 * (@fredericktownes)
 * [14 years, 3 months ago](https://wordpress.org/support/topic/plugin-w3-total-cache-defer-javascript-parsing/#post-2508833)
 * Additional options for this will come in a later release.
 *  [southcast](https://wordpress.org/support/users/southcast/)
 * (@southcast)
 * [13 years, 11 months ago](https://wordpress.org/support/topic/plugin-w3-total-cache-defer-javascript-parsing/#post-2508887)
 * Sorry to piggyback this thread. I saw no point in creating another thread on 
   the same topic. No spamming intended.
 * Dear Frederick, I have implemented your plugin on my site and it works awesome.
   I am using the **latest version 0.9.2.4**. I noticed that this thread is about
   4 months ago, so i was just wondering if you might have already added the “defer
   the parsing of javascript” feature and if it hidden somewhere in the setting 
   options coz I couldn’t find it. I checked the other tuts available on the web
   but some seemed risky and some are unnecessarily complicated.
 * P.S – Really thankful to you for such an efficient plugin. I have referring many
   people in my threads to use it.
 *  [Pothi Kalimuthu](https://wordpress.org/support/users/pothi/)
 * (@pothi)
 * [13 years, 11 months ago](https://wordpress.org/support/topic/plugin-w3-total-cache-defer-javascript-parsing/#post-2508888)
 * > i was just wondering if you might have already added the “defer the parsing
   > of javascript” feature and if it hidden somewhere in the setting options coz
   > I couldn’t find it.
 * [@southcast](https://wordpress.org/support/users/southcast/) This feature is 
   not added yet.
 *  [southcast](https://wordpress.org/support/users/southcast/)
 * (@southcast)
 * [13 years, 11 months ago](https://wordpress.org/support/topic/plugin-w3-total-cache-defer-javascript-parsing/#post-2508889)
 * Dear Pothi, very kind of you to give a feedback. I was suggested this code by
   someone in one of the non-wordpress forums. Code to be added
    just before the
   end body tag.
 *     ```
       <script defer="defer" type="text/javascript">
           window.onload=function(){
               var mycode;
               mycode=document.createElement("script");
               mycode.type="text/javascript";
               mycode.src="http://www.example.com/path/yourjavascriptfile.js";
               document.getElementsByTagName("head")[0].appendChild(mycode);
           }
       </script>
       ```
   
 * I have put this code in my footer template as suggested and it seems to work 
   but I am not very sure if that is the right place or the code is compatible to
   other browsers too. Please correct me if I am wrong. It helped to increase my
   page speed a bit though. Just asking to be sure about it. Will appreciate your
   response.
 * P.S – As the code has helped me a bit so I wanted to leave it here so others 
   looking for an alternative could try this too.
 * Cheers.
 *  [Pothi Kalimuthu](https://wordpress.org/support/users/pothi/)
 * (@pothi)
 * [13 years, 11 months ago](https://wordpress.org/support/topic/plugin-w3-total-cache-defer-javascript-parsing/#post-2508890)
 * I’m not too much into JS. I’m sorry. That’s why I’m looking forward to the next
   version of W3 Total Cache plugin too. 🙂
 *  [a4jp](https://wordpress.org/support/users/a4jpcom/)
 * (@a4jpcom)
 * [13 years, 11 months ago](https://wordpress.org/support/topic/plugin-w3-total-cache-defer-javascript-parsing/#post-2508891)
 * I need the defer option as well for JavaScript. My page is so slow even using
   your plugin.
 *  [a4jp](https://wordpress.org/support/users/a4jpcom/)
 * (@a4jpcom)
 * [13 years, 11 months ago](https://wordpress.org/support/topic/plugin-w3-total-cache-defer-javascript-parsing/#post-2508892)
 * I also get a message saying: The following cacheable resources have a short freshness
   lifetime. Specify an expiration at least one week in the future for the following
   resources.
 * Could you also make your plugin set the expiration date for images?
 *  [southcast](https://wordpress.org/support/users/southcast/)
 * (@southcast)
 * [13 years, 11 months ago](https://wordpress.org/support/topic/plugin-w3-total-cache-defer-javascript-parsing/#post-2508893)
 * I will share my observations which is currently working great for me. I will 
   mention it here so that the others looking for similar alternatives could possibly
   make use of this. As of now my settings seem to be working great on chrome, IE9
   latest and FF latest.
 * Firstly, there is a setting actually in W3Total using which we can minify a javascript.
   For this to work go to Performance – General settings – Minify – and Enable. 
   Then go to Performance – Minify – JS – JS file management – and add whatever 
   js files you want to. However, this method did not work for me as some of my 
   scripts did not seem to work while minified. I have mentioned it here nonetheless,
   just because there is such option available.. if someone wants to try. It may
   work for others if not for me.
 * Secondly, I use FB-likebox, like button and Gplus like button and I noticed that
   these social plugins are the major contributors in pulling down my GPS {Google
   page speed ) and Yslow scores. But then thankfully i discovered that google and
   facebook both provide asynchronous code for lazy loading. So i went ahead and
   made use of that and It made a massive difference in my scores.
    I have used 
   this asynchronous scripts as following in the footer **just above the </body>.**
 * Since the forum rules does not allow more than ten lines of code, I had to put
   it in pastebin. You can find the [complete code in pastebin](http://pastebin.com/MeMYG0b8),
   that which I currently use on my site.
 * For the facebook script to work you may want to put the following declaration
   into the header.
 * `<xmlns:fb="http://www.facebook.com/2008/fbml" xmlns:og="http://opengraphprotocol.
   org/schema/">`
 * Now all you need to do is paste the following appropriate codes to your template
   wherever you want the buttons or boxes to render.
 * **G-PLUS :**
 * `<div class="g"><div class="g-plusone" data-size="medium"></div>`
 * **FB** :
 * `<fb:like href="http://southcast.in/" layout="button_count" show_faces="false"
   width="100" height="21" action="like" colorscheme="light" font="trebuchet ms"
   allowTransparency="true"></fb:like>`
 * I am no expert coder or anything but after applying these codes my scores are
   pretty good now as I also use other online tools to assess my site’s performance.
 * P.S – Do not forget to clean your cache one you have made the changes to see 
   the results in the frontend. You may also want to test the changes in different
   environments because every browser uses unique parsing and rendering parameters.
 *  Plugin Contributor [Frederick Townes](https://wordpress.org/support/users/fredericktownes/)
 * (@fredericktownes)
 * [13 years, 9 months ago](https://wordpress.org/support/topic/plugin-w3-total-cache-defer-javascript-parsing/#post-2508895)
 * If you guys email me I can send you the next release with support for this option.
 *  [a4jp](https://wordpress.org/support/users/a4jpcom/)
 * (@a4jpcom)
 * [13 years, 9 months ago](https://wordpress.org/support/topic/plugin-w3-total-cache-defer-javascript-parsing/#post-2508896)
 * I want it ^^. Are you the original developer?
 *  [floriz](https://wordpress.org/support/users/floriz/)
 * (@floriz)
 * [13 years, 9 months ago](https://wordpress.org/support/topic/plugin-w3-total-cache-defer-javascript-parsing/#post-2508897)
 * Hi Frederick. Can ypu please send me the next release i would love to have this
   feature! Thanks!
 *  [ichpen](https://wordpress.org/support/users/ichpen/)
 * (@ichpen)
 * [13 years, 9 months ago](https://wordpress.org/support/topic/plugin-w3-total-cache-defer-javascript-parsing/#post-2508898)
 * I’d love a pre-release copy also. ichpen[at]gmail.com
 * Thanks Frederick.
 *  [leownn](https://wordpress.org/support/users/leownn/)
 * (@leownn)
 * [13 years, 9 months ago](https://wordpress.org/support/topic/plugin-w3-total-cache-defer-javascript-parsing/#post-2508899)
 * I want it please 😀 tendenciaselegantes gmail.com ur hotmail

Viewing 15 replies - 1 through 15 (of 24 total)

1 [2](https://wordpress.org/support/topic/plugin-w3-total-cache-defer-javascript-parsing/page/2/?output_format=md)
[→](https://wordpress.org/support/topic/plugin-w3-total-cache-defer-javascript-parsing/page/2/?output_format=md)

The topic ‘[Plugin: W3 Total Cache] Defer JavaScript Parsing’ is closed to new replies.

 * ![](https://ps.w.org/w3-total-cache/assets/icon-256x256.png?rev=1041806)
 * [W3 Total Cache](https://wordpress.org/plugins/w3-total-cache/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/w3-total-cache/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/w3-total-cache/)
 * [Active Topics](https://wordpress.org/support/plugin/w3-total-cache/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/w3-total-cache/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/w3-total-cache/reviews/)

 * 24 replies
 * 16 participants
 * Last reply from: [jcapdepuy](https://wordpress.org/support/users/jcapdepuy/)
 * Last activity: [13 years, 4 months ago](https://wordpress.org/support/topic/plugin-w3-total-cache-defer-javascript-parsing/page/2/#post-2508932)
 * Status: not resolved