HTML5 Local Storage Revisited

Local storage is also a handy way of transferring data between windows or tabs, if that’s needed.

You can test the storage limit and user settings with exception handling. If referring to window.localStorage throws an error, then user security policy has disabled it. If setting a value throws an error, then you’ve exceeded the data limit. The safest approach is to use exception handling every time you use local storage.

try
{
    var storage = window.localStorage;
}
catch(ex)
{
    //storage is disabled by user settings
}


try
{
    storage.key = value;
}
catch(ex)
{
    //set would exceed storage quota
}

JSON is very useful, but JSON itself is expensive to parse – if the data is complex and hierarchical, then yeah, JSON is a good choice. But if it’s just a bunch of simple values, then it’s better to use a simple delimiter (like comma) and parse that manually.

But in that browser cache vs local storage graph, are the colour codes the wrong way round, or am I missing something? The written conclusion is that local storage is faster, but the graph shows that browser cache is faster in every case.