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 user finishes. But what will happen if:
Also, I maintain user session through cookie based authentication. What will happen if the user logs off and log back in again? Is there a way to retrieve the data before the logoff?
Any documentation on handling this is appreciated. I skimmed through the spec, but it is not that good a read.
Thanks.
What is a persistent cart? Persistent carts are a feature that preserves the items that a customer has placed in their shopping cart when they exit the site without purchasing, using a cookie that identifies the customer for future sessions, even on other devices.
A persistent shopping cart in Magento is almost the same as a regular Magento shopping cart. However, the persistent cart can store products customers added to the cart for a period specified in the configuration, up to one year. The persistent cookie remains active even after the session cookies expire.
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.
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