Advertisement
Below are some of the differences between cookie, local storage and session storage,
| Feature | Cookie | Local storage | Session storage |
| --------------------------------- | ------------------------------------------------------------------------------------------------------------------- | --------------------- | ------------------- |
| Accessed on client or server side | Both server-side & client-side. The set-cookie HTTP response header is used by server inorder to send it to user. | client-side only | client-side only |
| Expiry | Manually configured using Expires option | Forever until deleted | until tab is closed |
| SSL support | Supported | Not supported | Not supported |
| Maximum data size | 4KB | 5 MB | 5MB |
| Accessible from | Any window | Any window | Same tab |
| Sent with requests | Yes | No | No |
Advertisement
JavaScript Coding Exercise 44
Test your knowledge with this interactive coding challenge.
Start CodingAdvertisement