re: Cookie, localStorage, or sessionStorage? VIEW POST

FULL DISCUSSION
 

Hi,

I strongly recommend the reading of Please Stop Using Local Storage. While localStorage is a great idea, it has flaws (not secure + can only stores strings + can’t work offline + generally limited to 5 MB of storage data) and should be avoided in favor of:

  • IndexedDB for various type of data (this small lib helps to use IndexedDb);
  • the Service Worker Cache API for network resources.

Like the article states, localStorage remains useful in a specific use case:

To keep it short, here’s the only situation in which you should use local storage: when you need to store some publicly available information that is not at all sensitive, doesn’t need to be used in a high performance app, isn’t larger than 5MB, and consists of purely string data.

code of conduct - report abuse