IE8 blocking JavaScript Cookies

Posted by ossreleasefeed on Stack Overflow See other posts from Stack Overflow or by ossreleasefeed
Published on 2010-06-01T19:03:07Z Indexed on 2010/06/01 23:33 UTC
Read the original article Hit count: 304

Filed under:
|
|
|

Hey there folks,

Here is one that is throwing me for a loop. I am trying to set a simple cookie that has one name:value pair on IE8. Tested on FF and it works fine. IE8 keeps blocking it.

I have read about the P3P stuff and created a basic P3P doc, no errors reported by the IBM tool, and added the following on all pages:

<meta http-equiv="P3P" CP="CAO DSP COR PSDa CONi TELi OUR STP COM NAV"><link rel="P3Pv1" href="/w3c/p3p.xml"></link>

The code I use to set the cookie is as follows:

function setCompatibilityCookie(c_name, value, expiredays) {
var exdate = new Date();
exdate.setDate(exdate.getDate() + expiredays);
document.cookie= c_name + "=" + escape(value) + ((expiredays==null) ? "" : ";expires=" + exdate.toUTCString());}

Any ideas why IE8 keeps blocking me from setting this cookie?

Thank you, Schalk

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about cookies