|
The <CFCOOKIE> tag allows your page to save cookies to the user's computer.
Not to be confused with the kind of cookies that you buy in the snack section of
your grocery store!
Syntax:
<CFCOOKIE NAME="cookie_name"
[VALUE="text_value"]
[EXPIRES="period"]
[SECURE="Yes" or "No"]
[PATH="url"]
[DOMAIN=".domain"]>
Attributes:
| ATTRIBUTE |
DESCRIPTION |
COMMENTS |
| NAME |
The name of the cookie. |
Required. Examples: "userid" "stock_id" "font_size" |
| VALUE |
|
Optional. In most cases you are going to assign some sort of value! |
| EXPIRES |
|
Optional. If you want cross-browser compatibility never use "NEVER"! |
| SECURE |
|
|
| PATH |
|
|
| DOMAIN |
|
|
Examples:
What is a cookie?
The cookie we are talking about is a small piece of text saved under a key value [NAME] that is
associated with a particular web domain. If a web domain writes a cookie, it is the only
domain that can read the cookie. This is done for security reasons.
What are cookies used for?
Used to retain a application "state" locally on the user's computer.
In many cases its used to "remember" such things as the user's id (so they don't
have to type it in every time). Other uses: Remembering the user's preferences.
What kinds of things should NOT be saved in cookies?
Passwords. Duh! Any kind of security type information. Even though a web site on another
domain cannot access the cookie, cookies are saved in plain text files that can be opened
if the user knows where they are being saved. If you are a developer don't save sensitive
information in cookies!
|