I understand the difference between localStorage and sessionStorage, but what is the difference between cookies vs local/session? Which one has more security, advantages, etc.? Which is better to use?
Greetings and thanks.
I understand the difference between localStorage and sessionStorage, but what is the difference between cookies vs local/session? Which one has more security, advantages, etc.? Which is better to use?
Greetings and thanks.
LocalStorage Information persists until you clear cache and local information. You can store tons of information, obviously your browser will consume more memory. Security is the browser itself, very strong to tell the truth.
Session Storage Information is stored until the browser or tab is closed. It can store more information than a cookie.
Cookies They store little information and last as long as you define them when creating them, one of the advantages is that you can easily grab the cookie in the front-end and in the back-end (without having to pass them through an AJAX for example if you wanted to use the LocalStorage or SessionStorage information, since that information only lives on the front-end) Security is limited, unless configured as httpsonly
Session Variables For my taste they are the best when making Apps, the session variables are controlled and created by the back-end, neither Javascript nor the browser intervenes here. The security of these is linked to the security of the server.
What would you wear? To tell the truth it depends on what you want to achieve and develop.