What is the soft limit (at which the user needs to give permission to exceed)? What is the hard limit (maximum allowed).
-
6developers.google.com/chrome/whitepapers/storage might be helpful.– dumbmatterCommented Jun 13, 2012 at 15:27
-
As most of these answers are out of date I'm adding a link to source (check the version tag): chromium.googlesource.com/chromium/src.git/+/refs/tags/…– holmberdCommented Apr 25, 2019 at 14:02
6 Answers
Update May 2020: Chrome now lets an origin use 60% of the storage device's space (Real nitty gritty: "storage device" is the partition containing the chrome profile directory). Updated article here https://web.dev/storage-for-the-web/#how-much
The rule of thumb is 6% (edit 2015-Jul: was 10%) of the available space on the user's hard drive, less if your origin is using websql, appcache or the filesystem api. The MDN doc mentioning 5mb was outdated and has been updated. The gory details about the current policy are here: https://developer.chrome.com/apps/offline_storage
Note some annoying subtleties:
- There is no PERSISTENT storage for indexeddb, only the stuff in the link above about TEMPORARY applies.
- Once your origin exhausts its share of the pool,
indexeddb transactions will unhelpfully abort with no real indication why. As of now the only way to determine that lack of quota is the cause is to use queryUsageAndQuota to check how much space is left. Hopefully a future version of chrome will soon properly fill out IDBTransaction.error in these cases.Edit: chrome 26 now properly fills out IDBTransaction.error with QuotaExceededError. - There is currently no API to request more storage space for indexeddb.
-
2Sorry, I'm a little confused by this. By 10% of the user's hard drive, do you mean that if the user had a 3TB hard drive, you could create an IndexedDB that is 300GB? And after that it would throw an error?– benshopeCommented May 14, 2015 at 20:29
-
3That's right. Honest question: what is the other interpretation you considered?– dgroganCommented May 21, 2015 at 17:46
Check quota with following code in chrome>dev tools(F12)>console
// Request storage usage and capacity left
window.webkitStorageInfo.queryUsageAndQuota(webkitStorageInfo.TEMPORARY,
//the type can be either TEMPORARY or PERSISTENT
function(used, remaining) {
console.log("Used quota: " + used + ", remaining quota: " + remaining);
}, function(e) {
console.log('Error', e);
} );
-
3Warning:
window.webkitStorageInfo
is deprecated. Please usenavigator.webkitTemporaryStorage
ornavigator.webkitPersistentStorage
instead.– cregoxCommented Nov 29, 2015 at 1:58 -
3See stackoverflow.com/a/29662958/2441511 for current standard, as of April 2015 Commented Nov 17, 2016 at 19:06
-
See developer.mozilla.org/en-US/docs/Web/API/StorageManager/… for newer standard.– EdwinCommented Apr 16, 2019 at 14:07
Warning - this information is outdated - see the other answer below.
Chrome has a 5mb soft limit before it hits a QUOTA_ERR
. Here's a MDN reference to that fact.
The spec mentions a QuotaExceededError
but doesn't seem to say anything about when it should be thrown.
QuotaExceededError The operation failed because there was not enough remaining storage space, or the storage quota was reached and the user declined to give more space to the database.
I've not heard of a hard limit and not reached one in my own development. Performance should go pretty far south before you reach it.
-
2That's partially true. There's a 50mb limit on most Chrome browsers but a 5mb limit on mobile versions of Chrome.– buleyCommented Jul 25, 2015 at 19:28
-
12What makes you think so? As far as I know neither of those things are true. (I wrote the Chrome IndexedDB quota enforcement code.) I just played around with demo.agektmr.com/storage on my phone to ensure it was still working and there was no 5mb limit there that I could see.– dgroganCommented Jul 25, 2015 at 20:22
-
I was wrong. Some html5rocks article was talking about FF mobile implementation and I conflated Firefox with Chrome. Thanks for correcting.– buleyCommented Sep 1, 2015 at 23:39
IndexedDB is given memory from the 'TEMPORARY' storage in Google Chrome. The temporary storage on Chrome has a default quota of 50% of the available disk space, 20% of which is available to your offline app.Requesting more quota against temporary storage doesn’t do anything.
Based on the above, answers to your questions would be:
- IndexedDB (on Chrome browser) can use storage without requesting it. (knowing it is allocated from temporary storage)
- Requesting more than the TEMPORARY storage limit (20% of 50% available, described above) will not allocate anything.
You could use the Browser Storage Abuser tool (cited in this HTML5Rocks article which has documented results for different browsers) to determine available temporary storage on the Chrome you are running.
I do not have enough SO reputation to post more links but the above HTML5Rocks article on quota-research has enough details to help you identify the appropriate storage type (TEMPORARY or PERSISTENT) and appropriate storage mechanism (if you haven't necessarily zeroed down on IndexedDB) as may be suited for your application.
The question is about Chrome and tagged IndexedDB. And I assume it is about websites, and not Chrome extensions or apps (which allow unlimited storage for IndexedDB).
For websites, IndexedDB is an API for Chrome Temporary Storage (source). So the question is about the quota for Temporary Storage in Chrome.
In Chrome 67, the quota behavior changed, and this is not really documented except in a bug report. Taken together, the current quota behavior is:
In Chrome Normal Mode
For Offline APIs (App Cache, File System, IndexedDB, WebSQL):
If the "should remain available" value is hit, the quota for one origin ("site") will be zero. The "should remain available" value relates to the space to keep free on mass storage. Since Chrome 67, it is the lower value of "2 GiB" and "10% of mass storage total capacity" (source). Once this limit is reached, additional writes to Temporary Storage will fail, but existing data in Temporary Storage will not be deleted.
If the "should remain available" value is not yet hit, the quota will be 20% of the shared pool (source). That (probably) means "20% of all data in temporary storage already saved by Chrome, plus all data that Chrome can save to Local Storage without hitting the 'should remain available' value".
For Web storage APIs (LocalStorage, SessionStorage, …): 5 MiB fixed (source); I don't know if this is affected by the "should remain available" limit documented above.
In Chrome Incognito Mode
The minimum or soft limit is 5MB- the browser will ask for permission to store the data. Maximum storage is the limit of your hardrive disk, as all of the data is stored locally on your machine disk. Basically if you have 20GB free storage than you can use all of the storage for IndexedDB.