[Zope] The trouble with cookies....
Jeremy Cook
Jeremy.Cook@ii.uib.no
22 May 2003 14:38:57 +0200
The trouble with cookies that I am finding is that when I set a cookie
from the server, it takes a finite amount of time to transmit it and
then read back the new value. It at least takes longer than it takes to
display a page. This causes a problem in the logic of my site because I
rely on the cookie to tell me something about the user.
I need to be able to set a cookie (or some other state variable?). Then
when I show the next web page I want the contents to reflect the new
value of the cookie, however when I read the just-set cookie back, it
has not yet been set to the new value!
You can see what I mean by going to this page:
http://kalandskolemusikk.no/?page=video
If you click on 'hare', you have to do it twice (or click once and then
reload) to get the title text to change blue (the same goes for 'snegle'
to get it to change green) because when the cookie is sent on the first
click, it has not been received back by the time the text is
redisplayed.
An obvious solution would be to have a 'parallel' local logic that
changes the color anyway without checking the cookie but I am reluctant
to do this because you are supposed to be able to come back to this page
with the cookie already set from a previous session.
Is there some way to do a 'blocking' setCookie, or is there some other
way to set a session based state variable?
--
Jeremy Cook <Jeremy.Cook@ii.uib.no>
Parallab