localstorage try catch code example
Example: localstorage try catch
try {
localStorage.setItem(key, value);
} catch(e) {
if (e.code == 22) {
// Storage full, maybe notify user or do some clean-up
}
}
try {
localStorage.setItem(key, value);
} catch(e) {
if (e.code == 22) {
// Storage full, maybe notify user or do some clean-up
}
}