[thelist] cold fusion cookie question

.jeff jeff at members.evolt.org
Tue Jul 24 18:33:49 CDT 2001


joe,

:~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
: From: Joe Crawford
:
: [...] can't think that in my experiences setting
: cookies (in PHP or CF) that I've /ever/ had to
: set a cookies' domain explicitly.
:~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

that's correct -- you don't *have* to set it.

:~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
: It's set implicitly by the browser, yes? So if I
: go to your site via the IP address, the domain is
: the IP address, if with the www, it gets set that
: way, if without, it gets set that way.
:~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

that's absolutely correct.  that's part of the reason why i'm insisting that
you don't need to concern yourself with the domain portion of it.  if rudy's
using cookies for session management then there's no need to even try to set
the cookies, let alone worry about the domain issue.  creating an
application via the <cfapplication> tag and telling it to set cookies is
enough.  the server and the browser will work out their differences.

:~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
: Also make sure to check the settings on your browser
: to alert you when cookies get set. I know, that's
: kind of obvious - but it helps in debugging.
:~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

yeah, kinda goes without saying.  one nifty little side-effect in ie that's
bound to be annoying is that persistent cookies (one's that last between
browser sessions) will not give you an alert about them being changed
(updated/deleted) once you've accepted it.  the only way to check the value
then is to go view the text file for that cookie on your local system or use
a nifty bookmarklet (see below) to check its value.

<tip type="bookmarklet" author=".jeff">

you wanna see the values of the various cookies on your system for the site
you're currently viewing?  save this handy bit of code as a favorite or
bookmark.

JavaScript:function _GetCookie(){if(document.cookie.length>0){var
cookie=document.cookie.split('; ');var alertStr='';for(var
i=0;i<cookie.length;i++){alertStr+=(i+1)+':
'+unescape(cookie[i])+'\n';}return alertStr;}else{return 'None';}}
alert(_GetCookie());void(0);

i know you could just as easily use the version from bookmarklets.com, but
this one makes it easier to see how many cookies and their values.

</tip>

good luck,

.jeff

http://evolt.org/
jeff at members.evolt.org
http://members.evolt.org/jeff/






More information about the thelist mailing list