Index ¦ Archives  ¦ Atom  ¦ RSS

Browser-Based Javascript Libraries

Today I want to talk about another idea I had regarding increasing both browser and server efficiency regarding javascript libraries.

There are a few major players in this realm including jQuery, mootools, prototype, and a few others. These libraries spend a considerable amount of processing time just checking the browser type and a percentage of their size is useless to each browser. Also, many web developers consider their sheer size as a large minus when choosing libraries.

As a way to offset both the inefficiency of browser-based javascript as well as decrease bandwidth wasted on downloading multiple copies of each library, a browser extension can be created for all major browsers with functionality to basically locally host the latest version(s) of the major libraries. Then, upon a website's request for the browser to download a library, it can figure out the version based on the filename (jquery.1.2.6.js) and push the local version instead. The local version would be pre-compiled and browser-specific to allow the greatest speed, and by not downloading the version from the server the page would load faster as well.

The necessary steps are detailed below:

  • Web developers would need to use the version of the library in the filename, such as jquery.1.4.4.js or prototype.1.6.js, in a very parse-able way.
  • Javascript library developers would provide browser-specific versions of their library, though this isn't necessary just yet
  • Browsers or extension developers would create a plugin/extension/feature that implements the localized library extension

A possible way to go about #2 would be to use pynarcissus ( in some way to find anything that may be a browser check and create browser-specific versions through that. I would work on this, but I don't have time so it's just an idea for now.

© Fahrzin Hemmati. Built using Pelican. Theme by Giulio Fidente on github.