A cookie is information that a website puts on your hard disk so that it can remember something about you at a later time.
More technically, it provides tracking information for future use, which is stored by the server on the client side of a client/server communication.Typically, a cookie records your preferences when using a particular site.
Using the Web's (HTTP) Hypertext Transfer Protocol, each request for a web page is independent of all other requests.
For this reason, the web page server has no memory of what pages it has sent to a user previously or anything about your previous visits.
A cookie is a mechanism that allows the server to store its own information about a user on the user's own computer.
You can view the cookies that have been stored on your hard disk (although the content stored in each cookie may not make much sense to you). The location of the cookies depends on the browser. Internet Explorer stores each cookie as a separate file under a Windows subdirectory. Opera stores them in a single cookies.dat file.
Cookies are small files which are placed on the machine of the person who is browsing the web and represent identity tags stored on a user's computer. They provide a way for a web site to keep track of a user's online behavior pattern. In general, cookies share these characteristics:
They are never greater than 4 KB in size.
They have a standard structure.
They each have designated expiration dates and times.
They are unencrypted.
They store user preferences.
Why use Cookies?
Cookies are used to work around the HTTP protocol, in which the server retains no information about the state of a connection with a visitor, it simply drops that information. While that poses no problem for most Web activity, it is undesirable for transaction-based activities such as shopping online. For example, a user may fill a shopping cart one day and may want to come back another day to complete the transaction.
Cookies help retain the state of transactions over time.
You will learn more about how cookies work in the following SlideShow.
Web Cookie Process
User options
Preferences for accepting or rejecting cookies are set in the browser. Although the name of the options change from browser to browser; in general, users can set the following preferences:
Do not allow cookies.
Allow cookies.
Ask each time.
Implications
Developers have no control over the preference settings in browsers of visitors. The implication is that site functionality could disappear if a site relies on the use of cookies and the visitor does not accept cookies.
Developers must choose between providing two versions of the site: one for those who accept or allow cookies and one for those who do not. The alternative is to design one site and risk losing visitors.
In the next lesson, you will learn how cookies are created.
On Your Own
Click the link below to practice testing the effects of cookies on a Web site. Testing Web Cookies