Welcome to WebmasterWorld Guest from 54.196.244.45

Forum Moderators: open

Message Too Old, No Replies

JavaScript Chips (cookie segments)

Functions compatible with ASPs cookies?

     
3:39 pm on Jul 11, 2002 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:Apr 10, 2001
posts:793
votes: 0


I've been mucking around trying to change some existing JS cookie functions to set and read cookie 'chips' in the same way that ASP does (through it's request.cookies and response.cookies) so the two are compatible - to avoid unnecessary round trips, I want to do some work with cookies on the client too.

I'm slowly going out of my mind trying to get it to work.

Josh

9:00 pm on July 11, 2002 (gmt 0)

Preferred Member

10+ Year Member

joined:May 24, 2002
posts:482
votes: 0


Josh,
If your talking about the asp sub cookies within cookies, (or maybe that's whole cookies within cookie categories), I tried that sometime ago. I too went out of my mind, but from an unrelated cause I think 8-). I finally gave up and made them simple, flat, one dimensional cookies. THese shared accross asp and javascript just fine. You can still build somewhat of a hierarchy into the cookie names, so it worked OK for me.

Good luck

10:21 am on July 12, 2002 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:Apr 10, 2001
posts:793
votes: 0


Yeah, sub cookies look something like

COOKIENAME=CHIPNAME=ChipValue&CHIPNAME=ChipValue

Where the ChipValues are escaped (%20 etc) - does the whole cookie value need to be escaped also - meaning that the ChipValues are escaped twice? This could be the root of the problem as for JS to deal with that we'd need a 'unescape' function.

hmmm :(

10:30 am on July 12, 2002 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:Apr 10, 2001
posts:793
votes: 0


Yeah! There is an 'unescape()' function. I'm think that might fix it now that I think about it.... I can't try it until I get back to work on Monday...
I'll keep you posted.
2:14 pm on July 12, 2002 (gmt 0)

Preferred Member

10+ Year Member

joined:May 1, 2002
posts:351
votes: 0


You could also try encodeURI() : decodeURI() or encodeURIComponent() :decodeURIComponent() if you are targeting newer (ECMAScript v3/Javascript 1.5 JScript 5.5) browsers.

escape() : unescape() has been deprecated.