A
Andrew Poulos
I'm using code adpated from quirksmode to read/write cookies. It seems
to work fine in a variety of browsers but when I try it in a HTA,
running on the local machine, no cookie values ever seem to be read and
I can't verify that a cookie has even been written. (Where does a HTA
hide cookies on a Windows XP box?)
Here's the code I'm using
fCreateCookie = function(name, value, days) {
if (days) {
var date = new Date();
date.setTime(date.getTime()+(days*24*60*60*1000));
var expires = "; expires="+date.toGMTString();
} else var expires = "";
document.cookie = name+"="+value+expires+"; path=/";
};
fReadCookie = function(name) {
var nameEQ = name + "=";
var ca = document.cookie.split(';');
for(var i=0; i < ca.length; i++) {
var c = ca;
while (c.charAt(0)==' ') c = c.substring(1,c.length);
if (c.indexOf(nameEQ) == 0) {
return c.substring(nameEQ.length,c.length);
}
}
return null;
};
What needs to happen for cookies to work in a HTA running on the local
machine?
Andrew Poulos
to work fine in a variety of browsers but when I try it in a HTA,
running on the local machine, no cookie values ever seem to be read and
I can't verify that a cookie has even been written. (Where does a HTA
hide cookies on a Windows XP box?)
Here's the code I'm using
fCreateCookie = function(name, value, days) {
if (days) {
var date = new Date();
date.setTime(date.getTime()+(days*24*60*60*1000));
var expires = "; expires="+date.toGMTString();
} else var expires = "";
document.cookie = name+"="+value+expires+"; path=/";
};
fReadCookie = function(name) {
var nameEQ = name + "=";
var ca = document.cookie.split(';');
for(var i=0; i < ca.length; i++) {
var c = ca;
while (c.charAt(0)==' ') c = c.substring(1,c.length);
if (c.indexOf(nameEQ) == 0) {
return c.substring(nameEQ.length,c.length);
}
}
return null;
};
What needs to happen for cookies to work in a HTA running on the local
machine?
Andrew Poulos