Web Developer Interview Questions

Explain what is the difference between cookies and local storage?

Cookies Local Storage
Client Side/ Server Side Data accessible both at client side and server side.  The data is sent to the serverside with every cookie request. Only at the local browser side data is accessible.  Server cannot use local storage until deliberately sent a request to the server via POST or GET
Size Storage capacity of cookies is 4095 bytes/cookie Storage capacity of local storage is 5MB per domain
Expiration Cookies have expiration and cookie data gets deleted after some time There is no expiration and has to remove manually

Leave a Reply