To use this website fully, you first need to accept the use of cookies. By agreeing to the use of cookies you consent to the user of functional cookies. For more information read this page.

Should browsers keep a permanent copy of important libraries?

14 Aug 2015 at 16:37
Browsers leverage caches, so why don't they just keep a copy of important libraries?

Downloading data is not so much of a problem with fast connections and less allowances as it once was, but there are still a large number of people who are restricted on their downloads because they are using a mobile device such as a smartphone or tablet which has a data cap added to it.

With necessary downloads of libraries being one of the largest files that any device has to download, caching may not be the best option.

The argument for

The argument is this, why do browsers themselves not keep copies of important libraries that websites use rather than download it each time?

This argument would certainly remove the data cap problem on smartphones for the unnecessary download of libraries over and over and it would also make website loading much faster.

Take my website for instance, a typical page comes in at 440KB, with 40KB of that to download jQuery, which although browsers will cache, it still may be downloaded multiple times for multiple websites (this is why using a CDN such as jQuery's own one is a great idea - one location means one cached version).

With regards to my website, jQuery 1.10 is all that is required - an old version of jQuery. Now if browsers retained a copy of this small library (40KB) then it would not be such a problem for those with small data allowances. I've worked hard to get my website (which started off with no real plan to become a mobile website) down to a reasonable size, but I still feel there is work to do.

The main argument comes from the fact that it is not being downloaded over the internet. This means two things. 

The first of those is that it reduces the amount of data being downloaded which is particularly useful for those of us with smartphones. The second benefit is that it increases security - one less file that can be tampered with on it's way to your computer. 

The argument against

Browsers would be bundled with the open source code which could potentially open backdoors to hackers. Change the original jQuery library ever so slightly and it could become a way in for anyone with malicious intent. 

Another argument against this idea is that jQuery is constantly being updated, so only older versions of jQuery would be able to be included - i.e. ones that are passed development stages and receive no more updates.

Let's also remember that these are libraries - not addons. That means that everything they do can be rewritten in pure JavaScript. Many developers do not like using libraries because they add unnecessary content to a web page or application.

I do believe however, browsers could continue to receive updates to add new versions of these libraries.

Conclusions

I am personally for this idea because it would allow me as a web developer to simply reference a bundled copy of jQuery. How much download time for my users that would save is definitely worth that. However, it puts more strain on the developers of the browser to ensure that these libraries are stored securely and safely. 

Let me know what you think of this idea by leaving a comment below.