How can I make a really long string using IndexedDB without crashing the browser?

Storing a Blob will use a lot less space and resources as there is no longer a need for conversion to base64. You can even store “text/plain” objects as blobs: var blob = new Blob([‘blob object’], {type: ‘text/plain’}); var store = db.transaction([‘entries’], ‘readwrite’).objectStore(‘entries’); // Store the object var req = store.put(blob, ‘blob’); req.onerror = function(e) … Read more

Persistence lifetime

It’s like localStorage, so it’s cross-session, meaning restarting browser or system won’t affect what is stored in it. However, user can clear it like clearing cookie. So it’s just like persistent cookie, you don’t trust it from the server-side, and you always need to check its integrity.

Query using multiple conditions

Check out this answer to the same question. It is more detailed than the answer I give here. The keypath parameter to store.createIndex and IDBKeyRange methods can be an array. So, crude example: // In onupgradeneeded var store = db.createObjectStore(‘mystore’); store.createIndex(‘myindex’, [‘prop1′,’prop2’], {unique:false}); // In your query section var transaction = db.transaction(‘mystore’,’readonly’); var store = … Read more

Conceptual problems with IndexedDB (relationships etc.)

I’m new to IndexedDB myself but I too have been thinking a lot about how I would use IndexedDB for purposes like this. The first thing I would suggest, if you haven’t done it already, is to look at how other key-value / document databases (CouchDB, MongoDB, etc.) work, since that’s essentially the type of … Read more

Storage limits on Chrome browser

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 … Read more