Websites - Cookies vs Sessions: Which are the pros and cons of using them

in #blog5 years ago

For anyone who has worked with Web development, cookies and sessions are part of any project. But cookies and sessions are more than that. Are two concept which are known to a lot of people, not only developers but also users of various platforms.

Both Cookies and Sessions have the same concept and idea on how to and why to use them

The idea between cookies and sessions is simple. We have some data, most of the cases user data that we need to save them and to use them in entire site, whenever we need them.

Cookies - Pros

  • Easy to use
  • Can be personalise
  • You can determine time of usage between user visits

Cookies - Cons

  • Security - Can be compromised easily
  • Privacy Issues

Sessions - Pros

  • Can be used for sensitive data not like cookies
  • Kept on Server Side

Sessions - Cons

  • Cannot be personalise like cookies
  • Expire easily when user closes the browser

christopherlaberintoKYRNDXVO0Hwunsplash.jpg
Photo by Christopher Laberinto on Unsplash

Although Cookies and Sessions can be seen and used as same thing there is a big difference between them. Cookies are stored in Client Side (User Machine/Browser), while Session are stored in Server Side.

Coin Marketplace

STEEM 0.15
TRX 0.17
JST 0.028
BTC 68936.57
ETH 2464.81
USDT 1.00
SBD 2.42