I would 开发者_StackOverflow社区like to write a cookie when I detect a back press in the browser. This is working correctly and writing the cookie when a back press is detected. Problem is that when my page I am going back to loads it does not always have that new cookie value in its $_COOKIE array. This is strange because sometimes it is there and sometimes not, I'm thinking this is a race condition. Any ideas on a fix?
In JavaScript, the cookie is accessed with document.cookie
. $_COOKIE
is a PHP thing.
精彩评论