I read few articles about IndexdDB, but couldn\'t find details about the lifetime of persisted data. I plan to use it for a session of data manipulation and upload once the
IndexedDB data belong to a type of temporary. So these data can be wiped out at any time.
These data size/lifetime are managed by very new Quota Management API.
In the future, IndexedDB could possibly used persistance type (not likely and not good idea too).
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.
Persistent Storage has been available in Chrome since v52 and Firefox since v55. Support in other browsers can't be relied on though. You must test if persistent storage is available and react accordingly.
if (navigator.storage && navigator.storage.persist) {
navigator.storage.persist().then(persistent => {
if (persistent) {
console.log("Storage will not be cleared except by explicit user action");
} else {
console.warn("Storage may be cleared by the UA under storage pressure.");
}
});
}
Chrome requires permission to use this feature. It will automatically be granted when calling navigator.storage.persist()
if any of the following are true:
This list comes from an article outlining Chrome's implementation which is updated periodically with new information about this subject.