Facilitating the Spread of Knowledge and Innovation in Professional Software Development

Write for InfoQ


Choose your language

InfoQ Homepage News Offline Storage Mechanisms Compared

Offline Storage Mechanisms Compared


Niall Kennedy has written an article on boosting Ajax performance using local storage. He discusses four different local storage mechanisms (cookies, Flash local shared object, userData in IE, and DOM storage in Firefox), mentions Dojo Storage as a way to abstract them and concludes that local storage is the next logical step for Ajax applications.

Kennedy describes the potentials of local storage for offline applications that could save changes locally and synchronize with the server when the connection is re-established. While this technique is nothing new, it is being rediscovered.

Just like other web technologies such as JavaScript and CSS, support for local data files addressable from a web page varies by browser. JavaScript libraries such as Dojo Storage abstract each storage method into a single JavaScript call with appropriate storage based on available resources (thanks Brad Neuberg!), but it’s useful to take a look at the low-level options and their respective limitations.

He continues by comparing and contrasting the four different types, describing their size limitations (from the 4KB for cookies to the 5MB for DOM Storage) and how they’re implemented. He concludes with:

Client-side storage addressable from any web page has the potential to change the way we build web pages and the division of labor between client and server. Just as CSS and JavaScript created new ways to style and interact with a page, the client-side storage capabilities of modern browsers will create a new concept of a web application runtime. It’s yet another step in the progression of web applications trying to create the best possible experience using the latest widely deployed web browsers and browser plugins.

In response to the article, there was some conversation on Ajaxian including a discussion of using browser cache. Brad Neuberg, of Dojo Storage, responded that there are two problems with using browser cache:

  • the cache pinning problem
  • application-created information (how to insert into the browser cache)

Rate this Article