For some reason, cookies have developed a rather negative reputation. In reality, they are quite simple and harmless. (This question has gained so much attention that Mytour has now published a full article on cookies.)
A cookie is simply a piece or several pieces of information stored as text strings on your device. A Web server sends the cookie to you, and your browser keeps it. The next time you visit the same page, your browser sends the cookie back to the server.
One of the most common uses of a cookie is to store a user ID. For example, a cookie might contain the following string:
Amazon.com is one site that employs this method. When you purchase a book, you fill in a form with your name and address. Amazon assigns you an ID, saves your details in its server database under that ID, and sends the ID to your browser as a cookie. Your browser then stores this ID on your hard drive. The next time you visit Amazon, the ID is sent back to the server. The server retrieves your information using the ID and personalizes the web page it sends to you. The page might greet you with "Welcome back, Joe Smith!"
You might be asking yourself:
- Is there more to cookies than that? Not really. They're just simple text strings. On my machine, there's a directory called c:\windows\cookies, which contains all of the cookies. They are small text files – you can open them to see the strings being stored.
- Are cookies dangerous? No. They're simply short text strings and can often improve your browsing experience by helping a server recall your customized settings.
- Are cookies widespread? Yes. There are over 500 cookies stored on my hard drive.
- Can cookies carry computer viruses? No. They are merely text strings.
- Can a company access my personal information through a cookie? No. Only the original cookie sent by the server is returned. It isn't altered or tampered with in any way.
Check out these fascinating links:
- How Do Internet Cookies Function?
- Cookie Frequently Asked Questions
- Understanding CGI Scripting
- The Role of Web Servers and the Internet
- How Hard Disk Drives Operate
