You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The best bet could be to try-catch and silently fail when saving to localStorage (depending if localStorage is critical for the app to work or not).
Since it would be mundane and error-prone to always wrap any localStorage.setItem call with a try-catch, you could create a global localStorageWrapper (and ban the direct localStorage access in JSHint for instance) like this (snippet for Object.create-supporting browsers)
The text was updated successfully, but these errors were encountered:
jakub-g
changed the title
localStorage in Safari on iOS in private mode has quota=0 and always throws on write
(iOS/Safari) localStorage in private mode has quota=0 and always throws on write
Oct 28, 2015
Platforms:
Safari on iOS
Summary:
When a new tab is launched in private mode,
localStorage
has zero quota assigned and hence alwaysthrow
s when trying to write to it.Example:
Workarounds:
The best bet could be to
try-catch
and silently fail when saving tolocalStorage
(depending if localStorage is critical for the app to work or not).Since it would be mundane and error-prone to always wrap any
localStorage.setItem
call with atry-catch
, you could create a globallocalStorageWrapper
(and ban the directlocalStorage
access in JSHint for instance) like this (snippet forObject.create
-supporting browsers)StackOverflow discussions:
http://stackoverflow.com/questions/14555347/html5-localstorage-error-with-safari-quota-exceeded-err-dom-exception-22-an
The text was updated successfully, but these errors were encountered: