My webapp have javascript errors in ios safari private browsing:
JavaScript:error
undefined
QUOTA_EXCEEDED_ERR:DOM Exception 22:An attempt was made to add something to storage…
my code:
localStorage.setItem('test',1)
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Apparently this is by design. When Safari (OS X or iOS) is in private browsing mode, it appears as though
localStorageis available, but trying to callsetItemthrows an exception.What happens is that the window object still exposes
localStoragein the global namespace, but when you callsetItem, this exception is thrown. Any calls toremoveItemare ignored.I believe the simplest fix (although I haven’t tested this cross browser yet) would be to alter the function
isLocalStorageNameSupported()to test that you can also set some value.https://github.com/marcuswestin/store.js/issues/42