The code snippet below works fine for me and need just one .cfm file:
<cfif isdefined("cookie.tmtCookieTest")>
<cflocation url="yescookie.htm" addtoken="No">
<cfelseif not isdefined("url.tmtCookieSend")>
<!--- First time the user visit the page, set the cookie --->
<cfcookie name="tmtCookieTest" value="Accepts cookies">
<!--- The cookie was send, redirect and set the tmtCookieSend flag as an
url variable --->
<cfheader name="Refresh" value="0; URL=#cgi.script_name#?tmtCookieSend=1">
<cfelseif isdefined("url.tmtCookieSend")>
<!--- We tried sending the cookie, no way, cookies are disabled, get out of
here --->
<cflocation url="nocookie.htm" addtoken="No">
</cfif>
The trick here is to use <cfheader name="Refresh"> instead of <cflocation>
after setting the cookie
----------------------------
Massimo Foti
[EMAIL PROTECTED]
----------------------------
My own Corner of the web
http://www.massimocorner.com
Dreamweaver, Ultradev and Fireworks goodies
"Russel Madere" <[EMAIL PROTECTED]> wrote in message
> That really won't work. The problem with it is that during the execution
of
> the CFM template, the cookies will exist. They are only refused after the
> HTTP headers are returned to the client. In other words, the cookies will
> be defined as long as the template setting them is executing.
>
> A better solution would be to set the cookies on a initially loaded page
and
> use a client side redirect to send the user to the test template. That
way
> the client will get the headers setting the cookies, and a new request
will
> be generated for the test template. If the cookies exist there, then the
> client accepts cookies.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at
http://www.fusionauthority.com/bkinfo.cfm
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists