Posted 2002-08-05T14:39:00+01:00 in web

Setting a cookie from a remote site

We wanted to set a cookie on one site and read it from another. That's not possible. Browsers that follow the cookie specs only allow you to read cookies from your own domain. But you always have a place for a transparant GIF image, don't you? So, just insert a image that originates from the domain where you'll be wanting to read the cookie, and add Set-Cookie HTTP headers to the image and you're done. Here's the example in a JSP page.
Cookie RFC: http://www.ietf.org/rfc/rfc2109.txt, http://www.ietf.org/rfc/rfc2965.txt