tags:

views:

43

answers:

3

hi,

on one domain i use command as::

setcookie( "cookiename", "cookievalue", time()+86400, "/", "domain1.com" );

on other domain i used a pixel code as

<img src="http://domain1.com/?action=trackcookie" width=1 height=1 />

that url not able to read cookie , but the same url able to read cookie when it is called directly. when i put htat url as a pixel code on other domain . it is not able to read value.

what might be the problem for this ??

Best Regards, Satish Kalepu

Hi, Yes I have checked httpwatch and firebug also..

http://www.domain1.com/tracking.php?action=setcookie that url put cookies:

Set-Cookie  topinno=1; expires=Tue, 27-Apr-2010 09:24:16 GMT; path=/
Set-Cookie  newkhan=%3A+2010-04-26+14%3A54; expires=Thu, 06-May-2010 09:24:16 GMT; path=/

on domain2 this url is called: in a iframe tag..

http://www.domain1.com/tracking.php?leadno=CREATEDLEADNO&amp;city=CITYOFTHELEAD

then those cookies are not coming...

but when i call the same url directly. again i am able to see cookies in request:

PHPSESSID=diebgrgusqofs2gckahu2nbm04; topinno=1; newkhan=%3A+2010-04-26+14%3A54; __utma=97007629.526966387.1270733785.1272261298.1272265835.45; __utmz=97007629.1270733785.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none)
A: 

Cookies are per domain based, you couldn't able to do that in another domain.

And If you do it in same domain, expires after two days should be "expires after two days" you are missing quotes, or it should be numbers in seconds.

S.Mark
Ofcourse. i used it on same domain ... 1. putting cookie on domain1.com. putted a pixel code on other domain2.com which loads image from domain1.com .. but that image request not able to see the cookie..
Satish Kalepu
Could you debug with firebug? cookie is properly receive / set at client side?
S.Mark
There's a Firebug/Firefox extension named FireCookie. That might help
Shiki
A: 

For reasons of privacy, many browsers block cookies that come from a different domain to the page itself.

David Dorward
A: 

Many browsers optionally put limitations on ‘third-party cookies’, that is cookies set by resources served from a different hostname than the main page address. Users hate tracking beacons; you should not rely on them always working.

In particular for the default settings of IE, you must create a P3P policy promising to be nice, or the browser will refuse to allow third-party cookies.

More background.

bobince