Wordpress Themes - Number Ones - Property in Germany - Find jobs - Wordpress Theme

PDA

View Full Version : Reading cookies from a specific host


dexfantasy
Apr 26th 2006, 8:35 am
Is there a way to only see cookies that have been set on a specific host (rather than domain)? For example, the institution I work for uses an LMS system called WebCT. There are multiple WebCT servers inside the same domain that set the same cookie name. Is there a way in Javascript to distinguish between the cookies set on the two servers? A script that parsed out only the cookies that have been set on the same host the script is running would be perfect--right now I'm getting a semicolon delimited list of cookies that set the same cookie name.

Thanks for your help,

dex

exam
Apr 26th 2006, 8:57 am
AFAIK, you can *only* access cookies for the same domain the script is on.

dexfantasy
Apr 26th 2006, 9:08 am
AFAIK, you can *only* access cookies for the same domain the script is on.

Yep - unfortunately, this isn't enough to avoid conflicts with the two servers since they are both in the same domain.

Actually... I think I figured out my problem. The cookie for the page you are currently on seems to always be listed later than previous cookies with the same name set on different servers.

So... Never mind :-)

Thanks,

Dex

exam
Apr 26th 2006, 9:26 am
Have the cookie name change for each host and only retrieve that cookie. If you haven't already found a workaround.

dexfantasy
Apr 26th 2006, 10:58 am
Have the cookie name change for each host and only retrieve that cookie. If you haven't already found a workaround.

The cookie name cannot be changed because its set by webct... That's the problem.

Basically, I was extracting the username of students who logged into their course by parsing a webct cookie, so that I can send it via AJAX to a remote server. Using the assumption that the current host's cookie will always be the last one listed in document.cookie, I was able to code around the issue... Hopefully this assumption is correct. So far, it seems to be working.

Thanks.

Matt

exam
Apr 26th 2006, 11:06 am
Well, it looks like you have a workaround. Hopefully that assumption is correct.