开发者

Writing a cookie when back pressed in javascript?

开发者 https://www.devze.com 2023-04-01 22:30 出处:网络
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 m

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消