Welcome to WebmasterWorld Guest from 54.144.77.26

Forum Moderators: open

Message Too Old, No Replies

JavaScript Chips (cookie segments)

Functions compatible with ASPs cookies?

     

joshie76

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

WebmasterWorld Senior Member 10+ Year Member



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

RossWal

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

10+ Year Member



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

joshie76

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

WebmasterWorld Senior Member 10+ Year Member



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 :(

joshie76

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

WebmasterWorld Senior Member 10+ Year Member



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.

moonbiter

2:14 pm on Jul 12, 2002 (gmt 0)

10+ Year Member



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.