I know there has been many questions about checking for localStorage but what if someone manually shuts it off in their browser? Here\'s the code I\'m using to
localStorage
Modifying Joe's answer to add a getter makes it easier to use. With the below you simply say: if(ls)...
if(ls)...
Object.defineProperty(this, "ls", { get: function () { var test = 'test'; try { localStorage.setItem(test, test); localStorage.removeItem(test); return true; } catch(e) { return false; } } });