Introduction to HTTP Cookies

Sometimes you may have noticed that your browser either it be Internet Explorer, Firefox or Opera keeps records of your online activities. And even web sites are getting smarter day by day. They seem to know more and more about you each time you visit. For instance you may bookmark some sites such as Amazon or New York Times, and you will find that computer on the other end knows not only that you have been there before, but exactly when you have last visited and what you were looking at the last time you clicked by.

Now the question arises how does know that it’s you? Why does the site for the New York Times ask you to log in when you browse from other location other than your home, but automatically logs you in when you browse from your home?

It’s all because of Cookies.

A Cookie is a small piece of information which is sent to your browser along with HTML page when you access a particular website. When you visit a web site, that web site can try to store a small amount of information on your computer hard disk. If your computer accepts the cookie, then your web browser will keep sending the cookie back to web site every time you access it.

Basic purpose of cookies is to differentiate users and to operate in a way that depends on the user by Web servers. Cookies were invented mainly to operate virtual shopping basket also known as “shopping cart”, this is a virtual basket when you do shopping in virtual market without cement and mortar common term used for it is “online shopping”. For online shopping you browse series of web pages for items to buy, whenever you like something you click add button on the same page and the item gets added to your cart. At the end you can see all the items together and accordingly you do transaction of money.

Here the participation of cookie is to maintain your session while you are doing online shopping, because of these cookies site always knows exactly what’s in your personal shopping cart. It does not seem to matter whether you’ve clicked away to somewhere else and come back.

Cookies are used for two main purposes:

– Session Management.
– Long-term user identification.

Cookies and session management

A session is a data storage that resides on the server and records information about one single user. When a browser makes first request from Web server, the Web server creates a session by sending a session ID to the browser as a cookie. On subsequent requests from the browsers, the web server uses the cookie information that is the session ID to find state associated with the user.

The web sites do so in order to behave differently on who is logged in. One good example is Once you log in, the web site has to keep track of you, so that it can show your personal page and not somebody else’s page.

Cookies and Long-Term User Identification

This type of cookie identifies the user. This is also like session cookie but only difference is that it is not deleted at the end of your computer session. Many web sites use these types of permanent cookies as a way to save the trouble of logging in again every time you visit the site.

Sometimes you may feel that its not a good idea to remember user name and password especially when you are logging on a public computer, well that is why most web sites make it an optional checkbox on the login page.

Since some web sites use Http cookie to keep track of users identity or other personal information, many users don’t want to accept them. In most modern browsers user can choose whether cookies should be used or not. Sometimes user discovers that it’s not practical to reject all the cookies because in doing so it becomes impossible to log in to certain web sites.

There are few misconceptions about cookies like:

– Cookies are like viruses that can erase data from the user’s hard disk.
– Cookies are a form of Spyware.
– Cookies are only used for advertising.

And many more misconceptions are there about cookies in the Internet world. Well Cookies are in fact only a piece of text, they cannot erase or read information from user’s computer.   


More by :  Ruchi Gupta

Top | Computing

Views: 3324      Comments: 0

Name *

Email ID

Comment *
Verification Code*

Can't read? Reload

Please fill the above code for verification.