Store large data client-side with AMASS

The AJAX MAss Storage System (AMASS) is a clever blend of JavaScript and Flash that doesn’t actually have anything to do with AJAX — except that it will help decrease the amount of AJAX you have to use to produce Web applications with rich user interfaces that behave like desktop apps.

AMASS inserts an invisible Flash movie the page in order to borrow a feature from the Flash Plugin, expanding JavaScript’s local data storage capacity (data stored on the end user’s machine, rather than on the Web server) from the 4KB offered by cookies up to 100KB, or even to any arbitrary size if the user grants permission when prompted.

Just what is this useful for? Well, with the amount of data users are typing into Web pages these days, features like undo and auto-save are starting to become vital, and AMASS makes them much easier (and less costly) to implement.

Gmail recently added auto-save to its offering, saving a draft copy every few minutes as you work on an email, so that you don’t lose your work if your two-year-old runs in and jabs the reset button on your computer again. Gmail implements this by periodically sending a copy of your work-in-progress to the server, but that’s a lot of bandwidth for such a simple feature. The reason for sending it to the server is that, traditionally, JavaScript was limited to 4KB of local data storage. Depending on how you use your email, messages over 4KB could be routine. With the expanded capacity offered by AMASS, this limit need no longer apply.

In its initial test version, AMASS supports Internet Explorer 6, Firefox, and other Mozilla-based browsers on Windows only. Linux is untested, and there are known problems on the Mac. Still, it’s an innovative idea that may pan out into a useful tool if the author can solve the compatibility issues.

Win an Annual Membership to Learnable,

SitePoint's Learning Platform

  • Etnu

    I’d still rather keep things server-side. I’ve never run into problems where I wanted to store more data on the client end.

  • Brad Neuberg

    Hi Etnu, I’m the lead developer on AMASS. Imagine creating a web based collaborative word processor in AJAX, where your writing is saved locally using AMASS for privacy until you explicitly publish it. In fact, AMASS can be used to save data privately on the client, so you control it, in many scenarios, including creating AJAX and AMASS enabled business applications in the browser where control over your own data is important. This might be a way for hosted service providers using AJAX to offer web based tools that can be used behind the business firewall. In the past businesses were loathe to use a service on a web site and have all of their data stored on it. Using AMASS, the remote web site would store the private data locally.

    Like the blog poster above says, AMASS needs to move from alpha and become more reliable until this can happen.

  • Dr Livingston

    > where your writing is saved locally using AMASS for privacy
    > until you explicitly publish it.

    You can already keep that privacy with most content management systems nowadays so I too don’t really see the point or any use of something like this.

    Bandwidth could be an issue I suppose but only if your really tight and don’t want to cover the costs of it. With paid services, the costs are covered.

    Problem solved then :)

  • http://www.dustindiaz.com polvero

    Let’s just hope it’s simple enough that developers won’t actually have to learn flash too much. If it’s a good api then hopefully that won’t happen.

  • Sjoerd

    A good usage of this would be downloading big javascript files to the user’s computer, so that they don’t have to download it again and again when entering your website. :)

  • dusoft

    expanding JavaScript’s local data storage capacity (data stored on the end user’s machine, rather than on the Web server) from the 4KB

    You are wrong. Javascript allows you store unlimited number of cookies (browsers do limit the number though).

    As you can read yourself:
    http://support.microsoft.com/default.aspx?scid=kb;EN-US;306070

    There is possibility to store 20 cookies having 4 KB each – that is 80 KB of plain text – more than enough for everything on the web (specially web forms).

  • Pingback: SkyrocketConceptsBlog » Blog Archive » Catfish Ad van sitepoint ontleed

  • http://www.haydur.com/ neodur

    If Gmail doesn’t need local storage, then I can’t really justify any other web-app needing such a feature.

  • Pingback: AJAX » Store large data client-side with AJAX MAss Storage System

  • Pingback: SitePoint Blogs » Bookmarks and back button history for AJAX apps

  • Magic8Ball

    I’m not certain I like the dependence on flash !!!! in fact this dependence terrifies me

  • Theodor Zoulias

    Storing a large amount of data in cookies is generally a bad idea, as they will travel back to server for each and every request.

  • why server-side beats it

    I was writing my mail at work, but did not finish it.
    Come home, picked up my draft and continued to work on it.
    That’s gmail. That’s server-side.

  • Mark Chipman

    Almost everyone here doesn’t see the forest through the trees… the HUGE advantages that this capability offers were previously mentioned:

    1. Saving LARGE sized javascript locally on your machine, so that on repeated visits, you don’t have to re-download the script… result is faster websites.

    2. Cookies always travel back and forth on EVERY post/request… so saving content in cookies (especially large cookies) is very very bad!

    Using AMASS could be conditionalized in code so that only browsers supporting Flash (installed) and viable for that platform (i.e. doesn’t work on Macs) would be ones to load-up AMASS and check if their is any javascript code that has been cached locally. Version checking could easily be done by flagging the stored code with an identifier, which could be used to see if a newer version of the javascript is available on the server… if their isn’t the code in the AMASS cache, then the required javascript could then be downloaded on the fly.

    All in all, AMASS sound very interesting and valuable to me… since I’m all about the speed of my websites.

    -Mark Chipman