-1

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.

Liam Bailey
  • 5,879
  • 3
  • 34
  • 46

3 Answers3

0

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?

Pointy
  • 405,095
  • 59
  • 585
  • 614
0

You can try Cookie plugin for jQuery.

Halil Özgür
  • 15,731
  • 6
  • 49
  • 56
0

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);
Liam Bailey
  • 5,879
  • 3
  • 34
  • 46