What do you mean by local storage in HTML5?

OR,

What is the difference between local storage and cookies?

Solution

Prior to HTML5, if you want to store data locally on user's browser, you have to use cookies. But cookies have their own limitations like:

  • Cookies are included with every HTTP request made to server which degrades the response time.
  • As cookies are sent with HTTP request they can be intercepted over network by hackers.
  • You can store up to 4KB of data in cookies.

Due to this limitations, HTML5 came up with new solution i.e. local storage which can store large amount of data locally & is not transferred to server. 

Local storage provides two objects for storage: 

  • window.localStorage
  • window.sessionStorage 

Share this thread

Comments

Comments
comments powered by Disqus

Navigation

Social Media