Reputation: 8629
I wanted to know if it's necessary to do a check if local storage is present or not when I try to use it.
Ie, I have this as a check:
if (global.localStorage) {
global.localStorage.setItem('layout', JSON.stringify({
[key]: value
}));
}
Or can I use localStorage without this check?
Upvotes: 11
Views: 14379
Reputation: 181
Mozilla maintain a table of desktop and mobile browser support here: https://developer.mozilla.org/en-US/docs/Web/API/Window/localStorage
Upvotes: 15