Title: Deferring Javascript
Last modified: January 24, 2020

---

# Deferring Javascript

 *  [Sitebuilder](https://wordpress.org/support/users/valetrends/)
 * (@valetrends)
 * [6 years, 4 months ago](https://wordpress.org/support/topic/deferring-javascript/)
 * So I have done several speedtests for my site on PageSpeed Insights, Gtmetrix
   and so on.
 * They all say I need to “Defer parsing JavaScript to reduce blocking of page rendering.”–“
   Defer Javascript” and that my site loads 23 Javascript files or something.
 * Now, I have tried all kinds of plugins to minimize and combine CSS and Java. 
   But nothing seems to work. I still get the message that the page is loading slowly.
 * Can I put in code somewhere in the site to fix this directly or something? And
   if not, please point me in the right direction and say what I should do very 
   thoroughly, step by step, if you can.
 * thanks
 * The page I need help with: _[[log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Fdeferring-javascript%2F%3Foutput_format%3Dmd&locale=en_US)
   to see the link]_

Viewing 3 replies - 1 through 3 (of 3 total)

 *  Moderator [t-p](https://wordpress.org/support/users/t-p/)
 * (@t-p)
 * [6 years, 4 months ago](https://wordpress.org/support/topic/deferring-javascript/#post-12362227)
 * You may want to look into a plugin to do it: [https://wordpress.org/plugins/search/Deferring+Javascript/](https://wordpress.org/plugins/search/Deferring+Javascript/)
 *  Thread Starter [Sitebuilder](https://wordpress.org/support/users/valetrends/)
 * (@valetrends)
 * [6 years, 4 months ago](https://wordpress.org/support/topic/deferring-javascript/#post-12362819)
 * Yeah I have tried those. But I am getting the same message still.
 * Many plugins seem to have this feature in premium only. Or nothing hapens when
   you press the switch for it.
 * If someone had a similar issue, please take me through how you fix it. Kindergarten
   style
 *  Thread Starter [Sitebuilder](https://wordpress.org/support/users/valetrends/)
 * (@valetrends)
 * [6 years, 4 months ago](https://wordpress.org/support/topic/deferring-javascript/#post-12363092)
 * By the way. It says I can do this in the HTML file using this code:
 * < script type=”text/javascript”>
    function parseJSAtOnload() { var element = 
   document.createElement(“script”); element.src = “script_to_be_deferred.js”; document.
   body.appendChild(element); } if (window.addEventListener) window.addEventListener(“
   load”, parseJSAtOnload, false); else if (window.attachEvent) window.attachEvent(“
   onload”, parseJSAtOnload); else window.onload = parseJSAtOnload; </script >
 * But.. Where is the HTML file? 🙂 Is that the theme editor under appearance or
   something?

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Deferring Javascript’ is closed to new replies.

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 3 replies
 * 2 participants
 * Last reply from: [Sitebuilder](https://wordpress.org/support/users/valetrends/)
 * Last activity: [6 years, 4 months ago](https://wordpress.org/support/topic/deferring-javascript/#post-12363092)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
