I am pretty new to this cookie stuff. I have a requirement where I need to set a cookie on the TLD (www.example.co.uk) from one of the subdomains (sub.example.co.uk) using Javascript. First of all, is it possible? if yes, how do I go about doing that? Any help on this would be highly appreciated.
Thanks,
L
I think you are confused about the definition of a TLD. You cannot set a cookie on a TLD. You can try to set a cookie on a different domain, but the browser may or may not accept it (look into the P3P header). I would set it in a shared domain. In your example, it would be
.example.co.ukand would work for http://www.example.co.uk and sub.example.co.uk.Try this (untested):