开发者

jQuery - Fire event at the end of a session?

开发者 https://www.devze.com 2023-02-19 05:14 出处:网络
Is it possible to fire an event at the END of a users session? What I\'开发者_运维问答m trying to achieve is to set a cookie based on the response to a \'pop up\' question. If the answer is YES i\'d

Is it possible to fire an event at the END of a users session?

What I'开发者_运维问答m trying to achieve is to set a cookie based on the response to a 'pop up' question. If the answer is YES i'd like to redirect somewhere at the end of a session.

Is this possible?


If you do this on each page or AJAX load:

clearTimeout(sessionTimeout);
sessionTimeout = setTimeout(onSessionEnd, TIMEOUT_IN_MINUTES*60*1000);

the function onSessionEnd() will get called when the session times out. As far as I know, the JS can't pick it out from the cookie, you need to tell your code what the timeout will be.

0

精彩评论

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