« Browser chess | Main | Craigslist data strategy »
April 28, 2006
JS costs
JS costs: Got big JavaScript libraries? Force the visitor's computer to retain these forever. "If you have developed an AJAX based web application you would know how many JavaScript files are required per webpage. If you use the prototype or dojo toolkit library you would know how big those JavaScript files can turn out to be... A website like digg takes up more than a minute to load on my dialup connection even though the main page is no more than a 27-32 KB. The real time is taken up by the JavaScript files... [this technique] sets the expiry of the JavaScript to years and not days. Once the JavaScript file is downloaded it is never downloaded again, of course unless you force it by removing the file in the cache." For versioning, they recommend renaming the .JS files and storing them alongside the older versions you can't remove. Obvious question: What happens to your computer when a thousand sites all do this...?
Posted by JohnDowdell at April 28, 2006 04:03 PM
Trackback Pings
TrackBack URL for this entry:
http://weblogs.macromedia.com/mtadmin/mt-tb.cgi/7366
Comments
Y'know, the more I think about this, the less I like it... it should be a user choice whether they wish to speed subsequent visits to the site, it's not something which should be pushed on all first-time visitors by any website. A browser vulnerability, to permit such behavior...?
Posted by: John Dowdell at April 28, 2006 08:04 PM
How would it be a browser vulnerability? The vulnerability would come in the actual content of the JS (or HTML or SWF or Java applet or ...). The vulnerability doesn't come from keeping it around for awhile (unless I'm missing what you're saying). [jd sez: If people called abuse of Flash's Local Shared Objects a problem, then caching arbitrary numbers of arbitrarily large files for "years" would certainly be one.]
Anyway, controlling the expiry date on web files is nothing new and the user always has the option of cleaning out his/her disk cache:
1) Firefox: Tools > Clear Private Data > Cache
2) Internet Explorer: Tools > Internet Options > General > Delete Files
3) Opera: Tools > Delete Private Data > Delete Entire Cache
Posted by: Jeff Schiller at April 29, 2006 03:06 PM
John, I thought the deal with LSO was that it was storing user data that could not be easily wiped out as easy as simple browser cookies. How does that relate to caching scripts to avoid long download times?
Posted by: Jeff Schiller at April 29, 2006 09:29 PM
Please note that, whatever "Expires" date the webmaster chooses to give the js file, if you don't visit the site the item will be rmeoved from your cache eventually (when more recent content comes in). What setting "Expires" do, is making sure browsers don't reload the js file on subsequent visits.
Websites can't control how long stuff is stored in your cache. But they can control how often stuff is reused from the cache, as opposed to redownloaded from the website.
If they do the slightly harder work of doing the versioning server side with the file name instead of by letting the browser redownload every time, they are doing us users a service.
Posted by: Rijk at May 1, 2006 02:39 AM