What is the difference in storage between session, cookies and localstorage?

Asked

Viewed 1,263 times

2

Where is the storage location of each of them? the local storage I heard it’s from html5 and it’s better that session and cookie, what the difference between them?

1 answer

3


Yes. The local Storage and Session Storage are two methods that are part of the HTML5 DOM update. We call these methods Web Storage. The Storage location and Storage Session as all DOM elements can be manipulated with Javascript and/or Json. To be very objective I will explain so:

Local Storage: with it you can store data privately in the browser. The data will remain persisted until the user triggers the method to destroy the object. Examples of use:

  • Forms where you want to store the data until the user finishes filling and send. This avoids that in the case of a power failure or an accidental closure of the browser the user has to type everything again.

In the case of Séssion Storage, the objective is the same. the only difference is that, the data will be stored differently for each browser tab and if in case the user closes the tab the data from that tab will be erased automatically. Examples of use:

  • Ticket shopping websites, whether bus or air ticket.

Cookies: Are files which serve the same purposes of storing user data to be used in the application/site. The difference is that cookies are stored on the client computer and have inferior performance compared to the web. Example of use:

  • Storage of searches, storage of accessed pages, etc.

Session: Protocol/method used to create the line of communication authenticated between your user and the program/application to be used. That is, in the session the data must be encrypted in the transmission. Example of use:

  • User login on facebook, stackoverflow, authentication of users in corporate proxy, among others.

I hope I helped. Big hug. the/

Browser other questions tagged

You are not signed in. Login or sign up in order to post.