What is the main Difference between local storage vs cookies?
Can you explain with example:
For further actions, you may consider blocking this person and/or reporting abuse
What is the main Difference between local storage vs cookies?
Can you explain with example:
For further actions, you may consider blocking this person and/or reporting abuse
Meidi Airouche -
Lukáš -
Reene -
TheDev -
Top comments (4)
A cookie is basically just information (a string) in the HTTP header. It can therefore be modified on client and server side.
The local/session storage is a key/value store in your browser and can therefore only be access on the client-side.
On a note, no one should be putting sensitive data in the Local Storage. This includes session IDs and JWTs. They are vulnerable if there is ANY possible XSS vulnerabilities, and while SQL Injection attacks today are mostly because of old tech, we are still finding XSS vulnerabilities.
I think this is true for every client side storage. It doesn't matter if it's stored in a cookie, indexdb or local storage. Tari is right. Never store sensitive data in such a storage.
Hope this helps
stackoverflow.com/questions/322066...