Cookies Overview
May 24th, 2008 | Author: ChipWhat are they?
A very small text file placed on your hard drive by a web page server when you access a site on that server. It serves as an identification the next time you access web pages on that server so as to extend the capabilities of web-based client/server applications. It is uniquely yours and can only be read by the server that gave it to you.
What are they for?
To let the server know that you have returned to a page/site you have previously visited. This can be useful in the following situations:
- Suppose you are filling a form and then accidentally close the window. A cookie set on your machine lets the server remember fields already filled-out.
- Allows you to customize what you want to see when you visit a portal like my.yahoo.com
- Monitors which advertisements were shown to you and how often each was shown.
Types of cookies
There are two types:
- Session cookies – expire after your session on that site
- Persistent cookies – remain until you clear your cache and delete cookies
Types of values a cookie can pass
- The name of the cookie.
- The value of the cookie.
- The path of the cookie is valid for – the URL path the cookie us valid in. Web pages outside of that path cannot use the cookie.
- The expiration date of the cookie – how long the cookie is active in your browser.
- The domain the cookie is valid for – makes the cookie accessible to pages on any of the servers on a multi-server domain.
- The need for a secure connection – states if the cookie can only be used on a secure server connection, such as on a site using SSL.

And, as I just discovered, cookies are seriously easy with MooTools – you simply say Cookie.set(‘cookieName’, cookieValue’);, and then Cookie.get(‘cookieName’);