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.
精彩评论