To reduce load times on our websites, we always cache some item in cookies and local storage. In this article some of differences between “Local Storage vs Cookies” is described.
Both Cookies and local storage serve difference purposes.
Choosing from these two
Cookies are primarily for reading server-side, local storage can only be read client-side.
So choosing from these two location to store data for our app, one question comes that, who needs this data : the client or the server?
If it’s our server need data, local storage isn’t so useful because we have to forward the data with each request by somehow (with Ajax or hidden form fields or something).
LocalStorage stays on the client, while cookies are sent with the HTTP header.