Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Easy Way to identify closing a tab or browser
If someone clicks the close button on a tab or browser, I need to invalidate a cookie.

Any ideas on how to do this?
There is no reliable way to detect a tab or page being closed that I am aware of other than a timeout on the server side. And in that case, there is no way to kill the cookie any more. You can simply set your cookies to have rather short timeouts and just keep renewing them as the user uses your application. That way when they close, the cookie will disappear within an hour or even minutes depending on the lifetime you assign to the cookie.
@Kudzu is correct. There is no way to accomplish that.

If you set your cookies to be a session cookie (in-memory cookie, transient cookie or non-persistent cookie. Do not confuse with "IW user session") it will be gone when the user closes the browser (the whole browser, not only the browser tab). It helps, although doesn't guarantee that the cookie will be destroyed.

Forum Jump:

Users browsing this thread: 1 Guest(s)