Be the first user to complete this post

  • 0
Add to List

sessionStorage vs localStorage vs cookie applications

sessionStorage, localStorage and cookie all are solutions to store data on client side. They can be used for

  • session management
  • user preference management
  • To setup never expiring tokens and many others.

sessionStorage - persists data only for a session

If your app redirects to a URL and comes back then its a new session. Hence, you can't use sessionStorage in that case.

localstorage - persists data until cleared explicitly, hence it persists across sessions

If you want your data to be cleared after sometime but still persist across different sessions, then its difficult to with localStorage.

cookie - persists until the cookie expires irrespective of session

You can use it across multiple sessions and you can delete it programmatically.



Also Read:

  1. webview - load html file
  2. What are reflows and repaints and how to avoid them
  3. Making max width work in internet explorer
  4. Getting started with localStorage vs sessionStorage in html5
  5. window.onload vs document.onload
  6. Getting started with webview in chrome apps