Cookie
From Ad Hacker Wiki
A cookie is a small chunk of text that remote Internet servers can store on your computer, and retrieve later. Cookies have many legitimate and very useful applications, the most obvious is for logging you into a site (such as Facebook or your favorite web email service). However, cookies can also be used to track your movement across the Internet and to record things you do.
Why were cookies created?
(This is over-simplified to make a very complex system understandable, so please don't quote me on this. For the technical description check out Wikipedia)
Essentially, each time you want to look at a web page (i.e. http://facebook.com/home.php ) your computer asks a far away server for a description of that page. The far away server (in this case facebook.com) then responds with a description of the page you requested (in this case home.php). Here is the important part: After the page is sent to your computer, both computers stop their communications and forget about each other. If you want another page, the far away server doesn't know you were the one who requested the last page. The geeky word for this is stateless - where nothing is remembered between page requests.
So what if we want Facebook to know it's me? ...so I can edit my profile and check messages? We need some way to tell Facebook during each page request that it's you coming back - and that is what a cookie can be used for.
How do cookies work?
An example:
- You type http://facebook.com/home.php into your browser
- Your browser asks the facebook.com server for the home.php page
- Facebook.com sends the home.php page to your computer
- Facebook.com ALSO includes a cookie with the page. Since this was the first time you talked to facebook.com today, they probably created a unique number to remember you by. This number was the "value" of the cookie.
- Your browser stores this cookie, and remembers it came from facebook.com. In the future only facebook can read this cookie back.
- A few minutes later you visit another facebook page, let's say you want to read your inbox. Again your browser asks facebook for the page. But this time your browser has a cookie from facebook, and it sends the cookie back to facebook.
- Facebook sees this cookie, looks at the number value, and recognizes you.
