What is localStorage in Html 5?
It is feature in HTML5 which let us store user data locally within user’s browser.
How it different from Cookies?
- They are more secure because web pages can access only access data stored by itself.
- They are more faster
- Easy to retrieve and write compare to cookies
- Not included with every server request
- Supports large amount of data and even won’t affect performance.
localStorage stores data with no expiration date whereas sessionStorage stores data for one session
Can we see a small example?