Page 267 - DCAP104_EXPOSURE_TO_COMPUTER_DISCPLINES
P. 267
Exposure to Computer Disciplines
Notes 14.4 Managing Cookies
14.4.1 Cookies
An internet cookie is a packet of information sent by a server to a browser, which is then sent by
the browser each time it accesses the server. Cookies are typically used to authenticate a registered
user of a web site, personalizing the site, maintaining an online shopping cart, etc. Originally
developed by Netscape, cookies offer convenience to the visitor if care is taken by the website.
Usually internet cookies are specific to one domain—meaning a cookie set by one domain cannot
be read by other domains. Many websites subscribe to media services that place advertisements
for them. One of the controversies surrounding cookies is the use of cookies to build a personal
profile of the user’s browsing and purchasing habits. One can set the browser to disable cookies,
or use Internet filter software to filter out cookies.
When you view a web page, the web server which sends it to you can store a small parcel of
text on your computer, which will be sent back to the server each time you request the same or
another page from the same web site. This bit of text is called an HTTP cookie, web cookie, or,
most commonly, just cookie. In addition to the text data, a cookie can have an expiration date,
at which time it will automatically be deleted—if it doesn’t have an expiration date, it will be
deleted when you exit your web browser.
The maximum amount of data that can be stored in one cookie is four kilobytes in most browsers,
the equivalent of about two pages of typewritten text. (By comparison, a standard 3.5” floppy
disk can hold 1,440 kilobytes of data, and a typical three-minute MP3 song takes about twice
that.), but most cookies use a fraction of that space. The number of cookies a browser will store
for a single web site (domain name, to be more specific) varies from browser to browser, but most
will allow 30 or more.
To understand how cookies work, you first must understand a bit about how the HTTP protocol
works. Here are the basics: When you enter an address in your browser’s address bar or click on
a link a page loads an image, video, or other file, what your browser is really doing is sending an
HTTP request to a web server. When the server receives your request, it loads or generates the
requested web page, image, video, etc. and sends it—in the form of an HTTP response—to your
web browser, which then displays it for you.
Both requests and responses can include extra information like browser type, date and time, and
so on in the form of “headers” which are used by your computer and the server, but not displayed
on your screen. When a server sends a response to your web browser, one of the headers it can
include is a “Set-Cookie” header, which gives the browser text data and an expiration date to
store in a cookie. Then, the next time you send another request to the same server, that cookie—
assuming it hasn’t expired—will be sent back, unchanged, to the server along with the request.
Now that you know how cookies work, you might be wondering what they’re good for--what
use is it for a web server to store tiny bits of data on your computer? Well, mainly web sites use
cookies to remember information about you and how you use them. For example, when you
view an item on Amazon, Amazon stores a cookie on your computer, and when you return to
Amazon’s front page, your browser sends the cookie back, and Amazon uses it to give you quick
access to the item you looked at before, or show you related items. A weather web site could
use a cookie to remember your ZIP code so you don’t have to enter it every time you visit. In
most cases if you log in to a web site and the site is able to “remember” you the next time you
come back, it does so using cookies. In many cases web sites don’t store the actual information in
cookies—that could be a security risk--but rather the information is stored in a database on the
web server, and a unique but meaningless value associated with the database record is stored in
a cookie on your computer.
260 LOVELY PROFESSIONAL UNIVERSITY