Firefox3 to support cross-site sharing of js libraries?
Well, it’s been more than a year that i’ve written ‘Cross-site caching of javascript libraries‘ and it looks like this feature (with a similar implementation to the one described) will make it in FF3.
javascript
More Dojo Goodies : JavaScript Linker
More Dojo Goodies : JavaScript Linker
I couldn’t resist blogging this… it’s an awesome tool!
Go checkout svn co http://svn.dojotoolkit.org/dojo/trunk/tools/jslinker, read
the instructions at http://svn.dojotoolkit.org/dojo/trunk/tools/jslinker/docs/readme.txt and … use it!
So, let’s say i create a web app that makes use of dojo and of tacos.
Currently, tacos.js is 54kb and dojo is at least 150kb. So, how about reducing this? How about keeping only the functions and the files that are actually called from the html files?
Well, that’s exactly what the JavaScript Linker does.
For my first example, i run
java -Xms8m -Xmx200m -cp jsl.jar:sisc.jar:bcel.jar org.dojo.jsl.top.Top –verbose –prj jsl.prj –sources ../tests/test_tacos.html
and was left with a 2.3kb dojo.js and a 6.3kb tacos.js
Doesn’t this rock??? Thx dojo & Well done to everyone involved.
Cross-site caching of javascript libraries
Cross-site caching of javascript libraries
This is a proposal for extending the script tag of HTML.
The purpose of this proposal is to allow browsers to take advantage of the many great javascript
libraries that are now in common use (prototype, dojo, scriptaculous, e.t.c.) by many different sites
and minimize bandwidth – download times.
The idea is, since I already have (in my browser’s cache) the X javascript library (because site Y uses it),
why do I have to redownload it while visiting site Z ?
So, I propose adding a hash attribute to the script tag. A browsers behaviour will go like this:
- if a script tag doesn’t have a hash attribute, continue as normal.
- if there’s a hash attribute, check our global javascript cache.
- If found, use library from cache.
- Otherwise, download library and use it. Also, compute its hash, and if it matches the hash attribute add
it in global cache.
So, what’s your opinion on this? Do you see any potential (security) problems?