A
asg
I have the code below that will retrieve a cookie that was placed by
the server (ie: joes.com) that the document resides on. I want to be
able to retrieve a cookie set by another server (ie: freds.com) but I
want to retrieve it from a page served by joes.com. This code
apparently using 'document.cookie' determines the server that the
document resides on and looks for cookies from that server. Anybody
know of code that will let you determine the server?
var name = "cookie";
function getCookie(name) {
var cname = name + "=";
var dc = document.cookie;
if (dc.length > 0) {
begin = dc.indexOf(cname);
if (begin != -1) {
begin += cname.length;
end = dc.indexOf(";", begin);
if (end == -1) end = dc.length;
return unescape(dc.substring(begin,
end));
}
}
return null;
}
the server (ie: joes.com) that the document resides on. I want to be
able to retrieve a cookie set by another server (ie: freds.com) but I
want to retrieve it from a page served by joes.com. This code
apparently using 'document.cookie' determines the server that the
document resides on and looks for cookies from that server. Anybody
know of code that will let you determine the server?
var name = "cookie";
function getCookie(name) {
var cname = name + "=";
var dc = document.cookie;
if (dc.length > 0) {
begin = dc.indexOf(cname);
if (begin != -1) {
begin += cname.length;
end = dc.indexOf(";", begin);
if (end == -1) end = dc.length;
return unescape(dc.substring(begin,
end));
}
}
return null;
}