views:

18

answers:

2

I'm setting a cookie during http GET request of the .html pages with embedded images. I'm expecting the browser to return the cookies when getting all the embedded images, but apparently it does not happen for the first embedded image.

Is this how it's supposed to work or am I missing something ?

+1  A: 

Make sure the domain name matches your domain and that you've set a valid expiration date/time for it. These are the 2 most common mistakes.

No Refunds No Returns
Again, the cookie is being returned for all http gets, except for the one sent immediately after the first one (which sets the cookie). This is the same code, so domain and expiration are OK. Moreover, I'm setting the cookie indirectly using Java servlets session mechanism, which I assume is bug free
Demiurg
A: 

It would help if we knew how you were setting the cookies. Note that NRNR's response is a bit misleading - he/she's right about the domain, but there's no requirement to set an expiration. However you will get varying results unless you explicitly set a path too - even if it's just '/'.

Browsers do vary a lot in how they handle all sorts of things, including cookies - so I wouldn't be too surprised if there are browsers out there which start retrieving additional content before the response headers for the referencing html page are processed. This is not how its supposed to work though.

C.

symcbean