02-04-2003, 08:50 PM
Can anyone please let me know as to how to disable the close(X) button of your browser window?
I am developing an application in which when a user clicks on a logout button, his logout time is recorded. But for this I should not allow him to instead click the close window button.
So how do I go about this.
02-04-2003, 09:36 PM
You can't do that, you will have to look for another solution. There are many posts here regarding logout times, however in classic ASP this is unreliable.
02-05-2003, 01:27 AM
...and here is a long thread about this:
02-05-2003, 01:31 PM
02-05-2003, 11:59 PM
Like I was saying it is unreliable in a web application (at least with classic ASP), and really the reasoning behind why is simple:
Since these are server-side applications, you have no way to know if the user has closed the browser, since no request is then sent to the server.
You can use onunload (or IE's onbeforeunload), but they are not very reliable either.
...as a matter of fact my ASP.NET books talk about this exact subject...
The only solutions I've seen rely on the application and session objects to set a false logout time when the session automatically expires, or someone else (the next user, for instance) updates an application variable...
02-06-2003, 08:53 AM
02-06-2003, 09:25 AM
even if there is no X button, you could still close the window by hitting Alt+F4 :D
if you look at the solution I suggested in the thread I posted, you can detect if the user clicks X or Alt+F4.
This may not be a complete solution, but still worth trying :)