A cookie is a tasty treat.
It's also a small string of text that's used to keep track of your computer when you browse the Internet. An HTTP cookie might track general information about your computer (such as IP address you used to connect or the type of browser you use) or more specific information about your browsing habits (such as the last time you visited a particular web site or your personal preferences for viewing that site).
The bit of text that makes the cookie is sent to your computer by a server when you first visit a website (or sometimes when you sign in to the site). After that, whenever your computer accesses that server, it sends the text string unchanged back to the server. The cookie identifies your computer to the server and lets the server know to send back the content that's relevant to your request and keeps it from mixing up the reply with the next person's request.
Cookies serve several different purposes depending on how long your computer stores them.
- Session cookies store information only as long as you're using the browser. Once you close the browser, it is erased. Session cookies are a way to keep you logged in so you don't have to reinput your password on every page. Session cookies can also hold onto your preferences or keep track of whether you've already visited a particular page. Session cookies are used on many websites to keep track of the contents of your electronic shopping cart.
- Persistent cookies are stored on your computer's hard-drive so that your personal preferences can be retained over time. Persistent cookies are how your computer knows to fill in your username by default when you open your Yahoo! or Hotmail email account or to display your personalized page appears when you visit Amazon.com. Persistent cookies can also be used by advertisers and others to keep track of your browsing patterns. If an attacker gains access to your computer, he/she may be able to gather personal information about you through these files. Persistent cookies may be set to "expire" after a certain period of time (usually a few days or weeks) but can be set to never expire.
If you are using a public computer, you should make sure that cookies are disabled to prevent other people from accessing or using your personal information.