> -----Original Message-----
> From: Erika L. Walker [mailto:[EMAIL PROTECTED]
> Sent: Friday, November 03, 2006 1:17 PM
> To: CF-Community
> Subject: Javascript and cookies
> 
> Argh. Programming.
> 
> Anyone know how to set the cookie and then read it back next time the
> user visits the site so it's automatically at the last language they
> used?

I've a JavaScript cookies abstraction that might help here:

http://www.depressedpress.com/Content/Development/JavaScript/Extensions/DP_C
ookies/Index.cfm

It provides pretty simple "get()" and "set()" methods (and a potentially
useful "enabled()" method).

For example (after you import the script) you can set a cookie for 90 days
like so:

DP_Cookies.set("MyCookie", "MyValue", 90);

Later you can retrieve the value into a variable with this:

var MyCookieValue = DP_Cookies.get("MyCookie");

You don't have to use the script to set/get the cookies - you can read
cookies set with CF (or anything else) as long as they fall within the
security restrictions of the current page/server.

Speaking of that my JavaScript debug library provides a simple
"dumpCookies()" method which lets you see all the cookies currently
available to JavaScript.  That library is here:

http://www.depressedpress.com/Content/Development/JavaScript/Extensions/DP_D
eBug/Index.cfm

Both components have full documentation at the link - let me know if you
need anything more.

Jim Davis



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Introducing the Fusion Authority Quarterly Update. 80 pages of hard-hitting,
up-to-date ColdFusion information by your peers, delivered to your door four 
times a year.
http://www.fusionauthority.com/quarterly

Archive: 
http://www.houseoffusion.com/groups/CF-Community/message.cfm/messageid:219486
Subscription: http://www.houseoffusion.com/groups/CF-Community/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.5

Reply via email to