Be the first user to complete this post
|
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:
- Remove the blank value from a html select option dropdown
- Getting started with webview in chrome apps
- A simple requestAnimationFrame example visually explained
- Making max width work in internet explorer