Copy link to clipboard
Copied
I need to know if the user has cookies enabled when he logs into my website so I can tell him/her to enable them. If they are not enabled, the SessionID will be lost and session vars will not work.
Copy link to clipboard
Copied
Enable session management in your Application file, with setClientCookies set to true. Then you can tell whether the client has cookies enabled by looking at the values in the cookie scope, by doing something like
<cfif isDefined("cookie.cfid") and isDefined("cookie.cftoken")>
<!--- cookies enabled --->
<cfelse>
<!--- we may assume cookies not enabled --->
</cfif>
If you are on ColdFusion 10 or 11 you should read up on the related subject of session fixation.
You might wish to avoid re-inventing the wheel. If so, you could just emulate or copy Ben Nadel's cookie test.