Cross domain cookie

setcookie("myCookie", 1, time() +50);
echo $myCookie."<br>";

<!doctype html> 
    <meta charset="UTF-8"> 

<a href=""></a><br>
<a href="">[COLOR="Red"]www[/COLOR]</a><br>
<a href="">[COLOR="red"]subDomain2[/COLOR]</a><br>
<a href="">[COLOR="Red"]term[/COLOR].kr</a><br>


The 4 links in the code above opens a same file.
But the cookie value doesn’t show when it clicks the link crossing the domain.

Is there anyway for making the cookie( or session or other global variables ) to work cross domain?

You can test it in

No, cookies can never be cross domain.
They can only exist in the same root domain (.root.tld [tld: com, net, org, etc]) and above


The domain that the cookie is available to. To make the cookie available on all subdomains of (including itself) then you’d set it to ‘’. Although some browsers will accept cookies without the initial ., » RFC 2109 requires it to be included. Setting the domain to ‘’ or ‘’ will make the cookie only available in the www subdomain.