Cookie Expiration Problem
I am having a problem with Google Chrome and Internet Explorer not properly handling the setcookie time() function. Firefox and Safari work fine.
This is the code that is causing problems in Chrome/IE.
They are both approx. 7 hours behind and they only way I can get the cookie to set is if I set the expiration time to at least the following.
I have checked the server time and it's set correctly. I have checked the time on my computer and it is accurate as well.
How come this is not working in those browsers?
What is the cross-browser solution to get a cookie to expire 1 minute from the current time?
Maybe a work-around would be to set the cookie for a comparatively long time, but also set a session value which is the actual desired expiration timestamp, maybe using the cookie name as the $_SESSION array key. Then on each page request, if the cookie is set, see if the corresponding $_SESSION value is either not set or has expired, and if so, unset that specific $_COOKIE value.
Yeah, it's a kludge, but might keep you going pending someone coming up with a "real" solution.
Well, I'd rather try and figure out what the actual problem is that is causing only these particular browsers to mishandle the expiration times.
Clearly there is some issue with the way they handle the time function and I'm assuming there must be a logical solution that doesn't involve a workaround.
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)