Is localStorage The New Browser Cache?

One of the features of HTML 5 is called localStorage.

localStorage was originally intended to overcome many of the limitations of cookies for storing context information on a user’s computer. But, like everything else on the Web, folks are starting to use it in new and interesting ways.

In a recent article, Steve Souders discusses his discovery that Bing and Google mobile sites are using localStorage instead of object caching, to store JS, CSS, and even images.

One of the problems folks developing mobile Web sites have discovered is that mobile browser caches are very small, so objects get aged out of the cache quickly, diminishing caching benefits. The resulting additional object traffic can be especially painful on the typically higher latency, lower bandwidth mobile networks.

It seems that localStorage is becoming the ‘new caching’ in the mobile world. But will it also make an appearance on the desktop?

By default, each origin receives 5 MB of space on the user’s computer. It’s easy to see the attraction of having a dedicated 5 MB of storage, instead of dealing with a shared cache, and various browser cache management mechanisms.

Is this the panacea that it seems? Some folks are citing performance issues with some browsers due to the synchronization needed to access localStorage.

Nevertheless, it’s a very interesting alternative (or compliment?) to object caching. And time will tell if it has legs.

One thought on “Is localStorage The New Browser Cache?

  1. Yes it is. There’s no reason not to use it as a browser cache.

    The browser cache sucks. It barely knows about the context, what really ought to be cached and what is safe to expire. Plus the client doesn’t have much control on the cache. And the browser cache only caches resources. Not fragments.

    localStorage is awesome as a flexible cache. Especially for fragments, see my blog post:

    Let’s use it, it’s just perfect for this kind of task. The only thing to fear of is what will happen once marketing companies realize how powerful it is.

Comments are closed.