Wrox Home  
Search P2P Archive for: Go

  Return to Index  

javascript thread: Looking at cookies on different domains


Message #1 by "Alexander Bienz" <alex@v...> on Mon, 20 Aug 2001 16:39:40
I'm using a function in Java Script called get cookie, here's the code for 
the function..

function getCookie(name){
// Use this function to retrieve a cookie.
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;
}

What I would like is to edit the code so that I can call a cookie held for 
a different domain other than the one that this code is currently on.

I've seen this sort of thing being done in a different way, but I would 
like to keep the code as similar as possible.

Any one got any ideas?!

  Return to Index