Site not setting cookies in internet explorer

4 replies
  • WEB DESIGN
  • |
Sorry if this is the wrong subforum. I'll gladly move this post if that's the case.

I've been putting together a website for a client, and I ran into a bit of a snag. For some reason, my shopping cart (a permutation of nopcart) won't work on internet explorer, and the problem seems to be centered around cookies. I knocked out the javascript errors and tried to run this code from the console:

function NewZone (ZoneParam){
SetCookie("ZoneSelected", ZoneParam, null, "http://redacted.com");
var RegionCookie= iGetCookie("RegionSelected");
if(RegionCookie!=null && RegionFromZone.length && !Element(RegionCookie, RegionFromZone[ZoneParam])) DeleteCookie("RegionSelected","http://redacted.com"); //delete cookie if now illegal
location.href=location.href;
}

NewZone("blargmuffin");

The code runs without errors, and it works in chrome and firefox, but when I check for the cookie in internet explorer, it isn't there.

Currently, the portion of the site I'm working on is located here: redacted and redacted.

The other pages haven't been fully updated

What am I missing?

edit:Fixed a permissions issue with the shopping cart, but it still doesn't set cookies in internet explorer.
edit:Fixed the cookie issue using this code.

var cookieToday = new Date();
var expiryDate = new Date(cookieToday.getTime() + (365 * 86400000)); // a year

/* Cookie functions originally by Bill Dortsch */

function setCookie (name,value,expires,path,theDomain,secure) {
value = escape(value);
var theCookie = name + "=" + value +
((expires) ? "; expires=" + expires.toGMTString() : "") +
((path) ? "; path=" + path : "") +
((theDomain) ? "; domain=" + theDomain : "") +
((secure) ? "; secure" : "");
document.cookie = theCookie;
}

function getCookie(Name) {
var search = Name + "="
if (document.cookie.length > 0) { // if there are any cookies
var offset = document.cookie.indexOf(search)
if (offset != -1) { // if cookie exists
offset += search.length
// set index of beginning of value
var end = document.cookie.indexOf(";", offset)
// set index of end of cookie value
if (end == -1) end = document.cookie.length
return unescape(document.cookie.substring(offset, end))
}
}
}
function delCookie(name,path,domain) {
if (getCookie(name)) document.cookie = name + "=" +
((path) ? ";path=" + path : "") +
((domain) ? ";domain=" + domain : "") +
";expires=Thu, 01-Jan-70 00:00:01 GMT";
}

setCookie("AmIOnFire","yes",expiryDate,"/");
#cookies #explorer #internet #setting #site

Trending Topics