Thursday, 5 July 2012

What is a Cookie


Cookie:
A cookie is used to maintain information about a user state. Cookies can be used to store user preferences and user information that can be used across pages in  the website. A cookie is also known as web cookie, browser cookie and HTTP cookie.
A cookie is stored as text strings on the computer. A Web server sends a cookie and the browser stores it. The browser returns the cookie to the server when the page is refrenced again. The most common use of a cookie is to store a user ID. A cookie may contain the string such as ID=96352398.

Example:
The website www.amazon.com uses cookies. The user fills a form with name and address to order a book. Amazon assigns an ID, stores user’s information with that ID in its database on the server. It also sends the ID to user’s browser as a cookie. The browser stores ID on the hard disk The browser sends the ID back to the server when the user visits Amazon again, The server customizes the web page according to the user ID.