Development : IE Cookie Issues

Cookie icon by Everaldo

Cookie icon by Everaldo

Just ran into an interesting issue in browser issue in storing cookies. Apparently, the standards-compliant way to code a cookie is “max-age”. But, on testing in IE (any version, any recent OS), the cookie will be active (not write however) for the current session, but once the browser is closed, then re-opened, all the current cookies will be gone.

Upon further investigation, the cookie tag “max-age” does not work in IE. The old tag “expires” must be used instead. This works in all current browsers. Hope this helps!

Correct!

document.cookie="value=test;expires="+expDate+";path=/";

Incorrect
document.cookie="value=test;max-age="+expDate+";path=/";

Sharing is fun!
  • Digg
  • del.icio.us
  • Facebook
  • Google Bookmarks
  • Faves
  • Twitter

Leave a Reply

You must be logged in to post a comment.