I'm working on a simple web utility that makes use of IndexedDB (similar to a key-value DB) feature of HTML5.
I was looking for but I was unable to know: what is the maximum size I can store in an item?
It lets you store just about anything in the user's browser. In addition to the usual search, get, and put actions, IndexedDB also supports transactions. Here is the definition of IndexedDB on MDN: IndexedDB is a low-level API for client-side storage of significant amounts of structured data, including files/blobs.
In both Firefox and Chrome, IndexedDB is slower than LocalStorage for basic key-value insertions, and it still blocks the DOM. In Chrome, it's also slower than WebSQL, which does blocks the DOM, but not nearly as much.
LocalStorage is slightly faster than IndexedDB in all browsers (disregarding the crashes). IndexedDB is not significantly slower when run in a web worker, and never blocks the DOM that way.
IndexedDB is a newer facility for storing large amounts of data in the browser. You can use it to store data of any JavaScript type, such as an object or array, without having to serialize it. All requests against the database are asynchronous, so you get a callback when the request is completed.
I don't think there's a specific limit for a size of a single item, only a global limit.
The rules regarding the global limit have changed since this answer was originally written. The up-to-date docs are on MDN - depending on the available disk space, the "group" limit (for the given domain, including all of its subdomains) can range from 10 MB to 2 GB.
The older answer - obsoleted with the release of Firefox 38 (2015-05), which removed dom.indexedDB.warningQuota
:
From an answer by mbrubeck at support.mozilla.com (I've replaced the links he provided with perma-versions):
By default in Firefox 4, a site can use up to 50MB of IndexedDB storage. If it tries to use more than 50MB, Firefox will ask the user for permission: http://mxr.mozilla.org/mozilla-central/source/modules/libpref/src/init/all.js#101
In Firefox for mobile devices (Google Android and Nokia Maemo), Firefox will ask for permission if a site tries to use more than 5MB: http://mxr.mozilla.org/mozilla-central/source/mobile/app/mobile.js#571 [...]
If the user grants permission for a site to exceed the 50 MB IndexedDB quota, then as far as I know Firefox does not impose any more limits. The only limits on the size of the IndexedDB database will be the user's disk space and operating system.
The localStorage quota is 5000KB, and there is no way for a web site to ask the browser for permission to store more than that amount in localStorage.
Adding to Nickolay answers, Here is the description of IndexedDB capacity in Chrome and IE
Chrome(Desktop) : By default, For Web-apps chrome doesn't prompt the user while storing data using indexedDB API. It uses the concept of shared pool, here is the complete description - Chrome HTML5 Offline Storage
Chrome for Android : Couldn't find any official link for stating quota. But from my experience, i have saved 300 MB of data without any prompts. Most probably same behavior as Desktop Chrome.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With