how to render blocking javascripts?
-
Google page speed showed I have a 23 java blocking scripts resources. This website told me I need to copy and paste this code into my website’s HTML.
https://varvy.com/pagespeed/defer-loading-javascript.html
This is the code it told me to use.
<script type=”text/javascript”>
function downloadJSAtOnload() {
var element = document.createElement(“script”);
element.src = “defer.js”;
document.body.appendChild(element);
}
if (window.addEventListener)
window.addEventListener(“load”, downloadJSAtOnload, false);
else if (window.attachEvent)
window.attachEvent(“onload”, downloadJSAtOnload);
else window.onload = downloadJSAtOnload;
</script>My question is how do I need upload this to my HTML so my website can be up and running again fast? I’m newish to web development so please bare with me on this..
- The topic ‘how to render blocking javascripts?’ is closed to new replies.