Hi
I am trying to set a cookie from a page in domain www.abcd.com and I want to read this Cookie in a page of www.123.com (different domain).
I fail all the time, is this possible to do that? if yes ,how can I cross domains?
below is my sample code:
****************************************************
var today = new Date();
var cookie_expire_date = new Date(today.getTime() + (2 * 7 * 86400000));
Set_Cookie("ifsize",sHeight,cookie_expire_date,"/" , false );
function Set_Cookie(name,value,expires,path,domain,secure) {
var cookieString = name + "=" +escape(value) +
( (expires) ? ";expires=" + expires.toGMTString() : "") +
( (path) ? ";path=" + path : "") +
( (domain) ? ";domain=" + domain : "") +
( (secure) ? ";secure" : "");
document.cookie = cookieString;
}
***************************************************
function readCookie(name)
{
var nameEQ = name + "=";
var ca = document.cookie.split(';');
for(var i=0;i < ca.length;i++)
{
var c = ca[i];
while (c.charAt(0)==' ') c = c.substring(1,c.length);
if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
}
return null;
}
thanks for your help and reply.