I implemented a LocalStorageHandler that checks if the browser supports local storage, if it doesn't support then I use a Cookie.
This is the function that checks if it supports local storage:
localStoreSupport: function ()
{
var testKey = 'test', storage = window.sessionStorage;
try
{
storage.setItem(testKey, '1');
storage.removeItem(testKey);
return true;
}
catch (error)
{
return false;
}
}
And this is how I dealt with false:
if (this.localStoreSupport())
{
localStorage.setItem(name, value);
}
else
{
document.cookie = name + "=" + encodeURIComponent(value) + expires + "; path=/";
}
I hope this helps you.