开发者

Cookie not being set in IE

I am setting a cookie in js and then checking in php whether it exists or not to determine whether the user has js enabled.

The non-js and js users are then served a different version of certain pages. This is working fine开发者_开发技巧 in ff, but not in IE? in IE we are seeing the version of the page as if no js is enabled, but it is.

http://edinburghfloorsanding.com/gallery/

Any help gratefully received.


Why not just add an extra form field via Javascript? Or put an extra form field in a <noscript> block, and if you see it then you know Javascript is disabled?


You can try Cookie plugin for jQuery.


It turned out it was because I was using the word true as the value. It is working now with this function:

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

Setting cookie like:

setCookie("jsenabled","yes",2);
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜