Home   |   About   |   Terms   |   Contact    
Read & Learn
 

Remove Render Blocking of JavaScript / jQuery

Web Design & Development

◄ All Articles


A new product.






Popular Google Pages:




This article is regarding Remove Render Blocking of JavaScript / jQuery.
Last updated on: .



◕ Render means loading or displaying. So if something is render-blocking, that means it is preventing the page from loading quickly. It is true that anything your webpage calls ( like .css or .js ), it will slowdown your page. More call more slow.

We all use jQuery in our Website or in Webpage. jQuery is a javascript file. If we check then we will find that normally it's file size is very large.



For an example:
Let my Webpage's file size is 5KB. But to make my webpage beautiful I am calling a jQuery file with a size of almost 70 to 100KB.

So why we should call such a big jQuery file when my page is just loading? We can call it later also, after loading my Webpage. There is no reason to load jQuery before loading my webpage. But most of us doing this.



How can we call a jQuery file after loading my Webpage?

Very simple. Just put the following code between your head tags. It is better to put this code just before the closing head tag.

<head>

<script type="text/javascript">

function downloadJSAtOnload() {

var element = document.createElement("script");

element.src = "URL-OF-YOUR-jQuery-FILE.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>

</head>

Your mission is complete. You can check your Webpage speed on google speedchecker before and after using this code.

The path is

https://developers.google.com/speed/pagespeed/insights/

◕ All the best.



◕ Related articles:
► How to make XML Sitemap?
► Robots.txt Fetch Error
► How to find URL of my Twitter Account?
► Difference between .html & .htm
► List of wildcard used in MySQL
► MySQL match a string
► Eliminate render blocking CSS
► Eliminate Render Blolcking JavaScript or jQuery
► How google will trust a site?





Popular Google Pages:





Top of the page

Amazon & Flipkart Special Products

   


Top of the page