Avoid using Javascript libraries (Jquery)

Javascript libraries are collections of pre-written Javascripts which in turn all perform certain separate functions. They can be used for the development of other Javascripts without the developer having to write his own Javascripts for the functions the library provides him with. Although there are several other Javascript libraries out there (MooTools, Prototype, JsPHP, Ext Core) the most widely used Javascript library today, with a landslide, is Jquery. This is why we’re mainly going to be focused on this library on this page.

Why Javascript libraries slow your website down

The reason Javascript libraries are bad for page speed is simple; you load a large collection of Javascripts without, in almost all cases, actually using 95% of those loaded Javascripts on your page. In almost all cases you only use a small component of the much larger library. This is not optimal for page speed since Javascripts need time to download and load on your web page. The more and bigger Javascripts you load, the slower your website will be. Test your website with this website speed test to see if it loads Javascript files that are limiting the performance of your website.

Avoid using Jquery alltogether

As said before, the most used Javascript library is the Jquery library, it is used for many of the popular Javascript plugins and custom made Javascripts. But not all Javascript developers rely on a Javascript library to create a Javascript. There are a lot of good scripts available which do not rely on a larger library but have all the functions Jquery can provide you with built-in in the Javascript itself instead of using a outside library. This assures you that only those Javascripts loaded on your site are the ones you actually use. When it comes to page speed, this is usually a much better option as using a library.

Can’t Avoid using Jquery? Use minified Jquery

Sometimes you just have to use Jquery for a particular Javascript you can’t avoid using. The problem is that many Javascript developers who use Jquery for their scripts tell you to add the uncompressed Jquery library(jquery.js) to your site for their Javascripts to function correctly. This is bad practice since Jquery specifically states that this version is meant for development purposes. Jquery gives you the option to download a compressed minified version of Jquery(jquery.min.js) which is much better for page speed since it’s smaller in size.

MooTools minified

The second most used Javascript library is MooTools. All of the above holds true for MooTools as well. Just like Jquery, Mootools also provides a MooTools minified, compressed version you should use on your web pages instead of the larger version.