PDA

View Full Version : cookie persistence bug



stamd
04-07-2008, 04:09 AM
1) Script Title:
Switch Content Script II (icon based)

2) Script URL (on DD):
http://www.dynamicdrive.com/dynamicindex17/switchcontent2.htm

3) Describe problem:
Script persistance doesn't always work. I'm using the script on every page. At first it appears to work fine, but if you first expand the contents then go to a bunch of pages where it's loaded each page, at some point it will show closed.

Go to another page, it's open, all without ever manually toggling. I took a look at the cookies it looks like it's due to multiple cookies being set and the way the code reads them.

Here's an example Cookie header with the problem, you can see there are multiple insantces of the cookies (icongroup2_d icongroup2_dtrack). I believe the cookie code does a regex search to find the cookie, so I think it's not getting the right cookie.

It looks like maybe it needs to set the cookies differently to avoid multiple instances. I verified this problem on the latest Firefox, Opera and IE 6.

Cookie: icongroup2_d=none; icongroup2_dtrack=7;
SESS3ed160102ec1b7baf016ecc409d58a5e=4d1b813b16b669b92e8d877f3c51;
icongroup2_d=0; icongroup2_dtrack=7;
__utma=1993981.899579.1207227.1207517231.1207227.1;
__utmb=1933981.27.10.12017231015; __utmc=193993981;
__utmz=13981.12075231.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none)

For now I just disabled persistence to avoid irritating my users with the problem.

BTW great site your stuff is awesome very impressed! Thanks so much for all your work.

ddadmin
04-07-2008, 05:13 PM
Well by default, the persistence feature isn't site wide, and local to each directory on your site. If you want to make it site wide, try adding the below changes in red to the following to lines:


document.cookie = name+"="+value+"; expires="+expireDate.toGMTString()+";path=/"

document.cookie = name+"="+value+";path=/"