2

I use localStorage and need to know how my website behaves when there is no storage left on user's device (or at least browser denies access to storage with a quota exceeded).

Is there any dev tool or any other way (other than filling my device with files) to simulate a "quota exceeded error"? It seems the reason why many users can't access my website.

James Z
  • 12,209
  • 10
  • 24
  • 44
Ilan Schemoul
  • 1,461
  • 12
  • 17
  • Maybe you can just simulate adding a whole bunch of data to the storage? Like random strings or something, and try and reach the limit yourself – Keff Jul 02 '20 at 14:17
  • These might help: http://crocodillon.com/blog/always-catch-localstorage-security-and-quota-exceeded-errors https://stackoverflow.com/questions/2989284/what-is-the-max-size-of-localstorage-values – Keff Jul 02 '20 at 14:18
  • @keff the storage quota seems too high for this method : "130076 MB storage quota" so 130gb – Ilan Schemoul Jul 02 '20 at 14:54
  • Ohh, I thought it was around 10mb per domain, although I'm not sure about this. – Keff Jul 03 '20 at 09:53

2 Answers2

3

Some browsers let the user enter local storage limits. Try setting a really low limit.

  • Opera: opera:config -> Domain Quota For localStorage
  • Firefox: about:config -> dom.storage.default_quota

See this.

A different approach could be to “fill up” local storage before your application starts, to simulate a full storage.

schteppe
  • 1,984
  • 13
  • 15
  • Thank you very much as I said filling up my 130gb quota seems not practical but firefox storage worked and massively helped me. Thanks again. – Ilan Schemoul Jul 02 '20 at 15:02
  • Remark: for setting low quota `default_quota` work; however for setting high quota you also need to set `default_site_quota` high. – user202729 Oct 28 '21 at 07:20
2

In newer versions of chrome:

"You can now override storage quota size in the Storage pane. This feature gives you the ability to simulate different devices and test the behavior of your apps in low disk availability scenarios."

"Go to Application > Storage, enable the Simulate custom storage quota checkbox, and enter any valid number to simulate the storage quota."

as seen here

Neveh
  • 323
  • 3
  • 7