Monday, May 20, 2024
 Popular · Latest · Hot · Upcoming
28
rated 0 times [  29] [ 1]  / answers: 1 / hits: 48314  / 7 Years ago, sun, february 26, 2017, 12:00:00

I'm getting QuotaExceededError (DOM Exception 22): The quota has been exceeded. on Safari when I'm in incognito mode.



I went through similar questions like this: QuotaExceededError: Dom exception 22: An attempt was made to add something to storage that exceeded the quota



But they talk about setItem, I get this error somewhere else.



I get this error on this line: localStorage['gallery.extensions'] = JSON.stringify({}); or localStorage['asdf'] = 'asdfg';



I tried combining this answer and replacing every line like localStorage['asdf'] = 'asdfg'; to be localStorage.setItem('asdf', 'asdfg') and every access like localStorage['asdf'] to be localStorage.getItem('asdf') but that didn't help either.


More From » safari

 Answers
13

You can't use local storage in incognito mode. By wrapping your setItem or getItem calls in a try/catch just helps your code handle the failed usage of local storage, and then alert the user that they need to use your application in a non-private mode.


The error you're getting is by design.


EDIT 2021: You can now use localStorage in Incognito mode. This error can also occur when you run out of the allowed storage space limit per app/domain. At the time of writing most browsers limit to 10mb.


[#58769] Thursday, February 23, 2017, 7 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
malaysias

Total Points: 619
Total Questions: 110
Total Answers: 107

Location: Czech Republic
Member since Thu, Aug 11, 2022
2 Years ago
;