I am using following code to save screen-resolution in cookie
var the_cookie="screen_resolution="+screen.width+"x"+screen.height+";expires="+today.setDate(today.getDate()+1);
document.cookie=the_cookie;
But some-how, it not working on browsers like IE 7 and 8.
Any idea, why it’s not working? Is screen.width and screen.height don’t retrieve screen-resolution on all browsers, or they have browser dependencies.
Change the code to something like this:
The
setDatefunction won’t return the new date as far as I know, so it means your cookie had no expire date… probably some browsers have a default, and some will treat such cookie as invalid.