4 ms·
No one should ever use cookies! You should use local storage, and only send what you need to the server and only when you need it
by matthewhall 10y ago
No one should ever use cookies! You should use local storage, and only send what you need to the server and only when you need it
- todd3834 10y agoThere are situations where cookies make more sense. Local storage gives you less control on the origin where that data can be accessed. Local storage doesn't let you set things such has HttpOnly so that JavaScript can not access the data (this is important to limit the risk of XSS when dealing with session ids). Local storage also doesn't give you as much control over when data should expire.
- aikah 10y agoSure but here we're talking about javascript cookies that aren't htttpOnly or secure. The expiration date and broad compatibility are the only arguments for the use of js cookies.
- todd3834 10y agoand the `path` attribute which allows you to control where a cookie should be used within the same origin.