Loading...
 
Skip to main content

History: CookieMonster

Preview of version: 8

The tale of the Cookie Monster

We got some legends in tikiwiki and that one is quite simple : sometimes some users get disconnected wildly after a time, or are said to enable cookies when it's enabled already, such oddities. Actually the fact is that the browsers limits the number of cookies per domain to 20 (I still wonder why, but I spent weeks to figure that out and it's verified).

The Hunt

The cookie monster is not well hidden, it's a common javascript set of functions that centralize manageement of cookies for the menus switching, the tabs memory, and such things. The lair of the cookie monster is in line 347 in {CVS()}lib/tiki-js.js{CVS}

setCookie(name, value, expires, path, domain, secure)

  • used by other js functions with only 2 first args
  • used by js tz_offset with 4 args

getCookie(name)

  • used in other js functions

deleteCookie(name, path, domain)

  • not used anywhere, surprising

The Kill

The display-pref cookie is called by smarty to know if that menu item is close or open at display. Teedog suggested to use a SESSION but actually the value of it has to be changed by javascript with no reload action in case of dynamic meus.
The best idea for a kill up to now is to use only one cookie for all tiki display preferences, and serialize all proferences in a longer string. That requires some rewriting of the 2 js function above, and also to change the cookie checks in smarty templates to check inside a mixed string.

All Lived Happy Ever After

The beast has been reported dead on a saturday afternoon. The problem will persist on older browsers which do not support the features required to store those cookies in the session (supported in Mozilla (and all the Gecko family), Safari (untested) and IE >= 5).

History

Information Version
homunq english 11
View
Fortytwo 10
View
sylvie greverend cookies status 9
View
Louis-Philippe Huberdeau 8
View
John Enok Vollestad 7
View
Mose 6
View
Mose 5
View
Mose 4
View
Mose 3
View
Mose 2
View