Highlighted

How can you determine from within CF if cookies are enabled in the browser you are using?

Participant ,
Sep 13, 2014

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.

TOPICS
Advanced techniques

Views

987

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more

How can you determine from within CF if cookies are enabled in the browser you are using?

Participant ,
Sep 13, 2014

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.

TOPICS
Advanced techniques

Views

988

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Sep 13, 2014 0
BKBK LATEST
Adobe Community Professional ,
Sep 14, 2014

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.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Sep 14, 2014 1