How to catach a close event on a website without javascript?

How can i catch a close event on a web page without the use of javascript. I have a site that a users has to log in to and from that I have to keep track of if they are logged in or not. My problem now comes when the user has to be marked as logged out. How can I solve the problem that when the browser closes unexpectedly that it then carries out a method that will mark the user as logged out. The log out methods works when the users logs out and then closes the application.

2 Answers

  • 1 decade ago
    Favorite Answer

    Bottom line: It's not possible, except maybe with VBScript. However, if you use that, you must understand that it will only work if the user is running a compatible browser on Windows. If you need to make sure users are logged off, you could try "timing out" their logged in status. i.e., after x number of minutes in which they do nothing, you assume the browser is closed and log them off automatically.

  • 1 decade ago

    The problem you have is that the browser runs on the client and to detect events on the client you need a client side language. The only alternative that I know of is VB Script but that is not cross-browser compatible and is not supported in other Web Severs like Apache.

Still have questions? Get your answers by asking now.