What are Cookies?


If you surf the Internet (not only Facebook and Gmail but other websites too) you would’ve come across the word Cookies. So what are these cookies and why does a website asks me to enable cookies or show a message at the bottom telling me they need to store cookies? In this post, we’ll discuss What are Cookies? Why are they used? What are the advantages and disadvantages of storing cookies and are they dangerous?

What are Cookies?

Cookies are small files that a website stores in your computer when you visit their site. They’re little encrypted messages that website stores in the user’s machine to help the user navigate their website efficiently and do specific actions in the future. Developers program cookies to help servers deliver a page tailored to the user according to his preferences. When it comes to Web Technologies, these little piece of information known as cookies play a very important role.

Why are Cookies used?

As stated above, cookies are small files delivered by the web server on an user’s machine. These cookies help the website find users and their preferences and hand over right pages according to user’s preferences. HTTP protocol is a stateless protocol, so when you move from one page to other the state/information of user is lost. So a web server asks the browser to save cookies to help it keep a track of person. This cookie can be used for various purposes. For example:
1. If you visit a multilingual website, and select your language as English, the website will store a cookie with your language preference as English. The next time you visit the same multilingual website, it’ll check if it has previously delivered you any cookies and after finding it out, will directly give you an English version of the website. If there was no cookie, it’ll ask you for your preference again and again every time you visit that website.

Use of cookie 1

Use of cookie 1

2. When you sign in into any mail account and select the small ‘Remember Me‘ box, you’re actually permitting the web-server to store cookies in your machine, and it does so. So if you don’t sign out and simply close the window and reopen it to visit the same page, it won’t ask you to sign in. It’ll directly show you your home/inbox. The cookie will is present until you sign out. If you didn’t check ‘Remember Me‘ , the web server still stores the cookie for that particular session and deletes it when you close the window or sign out. You’ll then have to sign in every time you close the window.

Use of cookie 2

Use of cookie 2

3. As stated above HTTP is a stateless protocol, so when you visit any e-commerce website and sign in, it creates a cookie with user’s information in an encrypted text. Then when you put any item on cart, the web server modifies the cookie and adds the item in it. When you click on another link on same website, you visit a new page and hence the state of user is lost, so web server looks into the cookie and brings the items in cart and shows it to the user. Cookies can help any website store a user’s preferences and data for further use.

Advantages of Cookies!

Now that we know what cookies are and why they’re used, lets look at the advantages of using a cookie.

  • Cookies help keep up states and information of user thus helping the server by reducing its work.
  • Cookies help save user’s preferences so that user doesn’t have to go and select the same option every time.
  • Each website has its own cookie and so each website can use only its own cookie.
  • In any e-commerce website, Cookies help keep track of items users puts in their shopping cart.
  • Cookie helps web-server find the user and deliver tailor-made results directly to the user.
  • Cookies are small and thus very convenient to use and doesn’t usually creates any problem.

Disadvantages of Cookies!

Like pros, cookies have some cons too. Here are the disadvantages of cookies:

  • Some web servers do not encrypt the user login information text in cookies. If user has same password on multiple sites, his privacy can certainly be compromised.
  • Sometimes, cookies come from advertising websites and can create detailed reports of various people.
  • To transfer cookies HTTP protocol is used, so an attacker can get hold of your cookie and use it for malicious purposes.
  • It can be easily mistaken for a spyware because some cookies store user histories and activities on website.
  • If an attacker get holds of you cookie, he can know everything about from browsing history to your preferences.

So that’s almost most everything you need to know about cookies. Cookies usually last until the window is open, but it can last for any amount of time. If you don’t allow cookies, you’ll probably be locked out from various social networking sites and you’ll definitely have a hard time on the internet. However, you can use third-party applications like CCleaner to easily erase all the cookies.

Leave a comment

Your email address will not be published. Required fields are marked *