We help IT Professionals succeed at work.

Check out our new AWS podcast with Certified Expert, Phil Phillips! Listen to "How to Execute a Seamless AWS Migration" on EE or on your favorite podcast platform. Listen Now

x

Cookie not being saved in IE 8

DistillingExperts
on
Medium Priority
401 Views
Last Modified: 2012-05-11
This function is not saving the data in the Internet Temporary Files folder. Any reason why (Windows 7, IE 8)?
function setCookie(name, value, expires, path, domain, secure)
{
  var curCookie = name + "=" + escape(value) +
      ((expires) ? "; expires=" + expires.toGMTString() : "") +
      ((path) ? "; path=" + path : "") +
      ((domain) ? "; domain=" + domain : "") +
      ((secure) ? "; secure" : "");
  document.cookie = curCookie;
}
Comment
Watch Question

CERTIFIED EXPERT

Commented:
This looks more like Javascript than PHP, so I think you might need to repost it in the javascript forum..... still from the code above my first guess would be that expires.toGMTString() is outputting either the current time or a historic time. In either of these cases the cookie expires as soon as you write it. Check expires.toGMTString() and make sure its expiry is in the future - even if only an hour.

Next, have you checked if these expires in other browsers because you only mention IE8. If it is OK in other browsers then check the following items which are known to cause cookie problems for IE

1. What is the server's clock showing for time. If the server's clock is different from yours IE will expire the cookie

2. Does the website contain an underscore in the domain name? If so then IE tends to drops sessions and cookies

Try that lot out and post back with the results.
Mohamed AbowardaSenior Software Engineer
CERTIFIED EXPERT

Commented:
Make sure that cookies is not disabled on IE.
Most Valuable Expert 2011
Author of the Year 2014
Commented:
Unlock this solution and get a sample of our free trial.
(No credit card required)
UNLOCK SOLUTION
Unlock the solution to this question.
Thanks for using Experts Exchange.

Please provide your email to receive a sample view!

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.