Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 7 of 7
  1. #1
    New to the CF scene
    Join Date
    Feb 2003
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Disable the X button of browser window

    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.

  • #2
    Senior Coder
    Join Date
    Jun 2002
    Location
    41° 8' 52" N -95° 53' 31" W
    Posts
    3,660
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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.
    Former ASP Forum Moderator - I'm back!

    If you can teach yourself how to learn, you can learn anything. ;)

  • #3
    Supreme Master coder! glenngv's Avatar
    Join Date
    Jun 2002
    Location
    Philippines
    Posts
    11,075
    Thanks
    0
    Thanked 256 Times in 252 Posts
    ...and here is a long thread about this:
    http://www.codingforums.com/showthre...=&threadid=980
    Glenn
    ____________________________________

    My Blog
    Tower of Hanoi Android app (FREE!)
    Tower of Hanoi Leaderboard
    Samegame Facebook App
    vBulletin Plugins
    ____________________________________

  • #4
    Regular Coder
    Join Date
    Jan 2003
    Posts
    867
    Thanks
    4
    Thanked 8 Times in 8 Posts
    I had a similar problem. Our solution was to use javascript to detect when the user was leaving the site and automatically log them out (there are many scripts available to detect this, but it creates a lot of work for the webmaster). It was "preferred" rather than "vital" that people logged out and the site only worked for people who had javascript enabled anyways, so it was a perfect solution for us.

  • #5
    Senior Coder
    Join Date
    Jun 2002
    Location
    41° 8' 52" N -95° 53' 31" W
    Posts
    3,660
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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...
    Last edited by whammy; 02-06-2003 at 01:04 AM.
    Former ASP Forum Moderator - I'm back!

    If you can teach yourself how to learn, you can learn anything. ;)

  • #6
    New Coder
    Join Date
    Jan 2003
    Location
    Peterborough, UK
    Posts
    39
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I guess you could launch the application in a window with no borders or other paraphernalia, such as used by some advertisers. You'd need to check javascript sites to work out how this is done.

  • #7
    Supreme Master coder! glenngv's Avatar
    Join Date
    Jun 2002
    Location
    Philippines
    Posts
    11,075
    Thanks
    0
    Thanked 256 Times in 252 Posts
    even if there is no X button, you could still close the window by hitting Alt+F4
    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
    Glenn
    ____________________________________

    My Blog
    Tower of Hanoi Android app (FREE!)
    Tower of Hanoi Leaderboard
    Samegame Facebook App
    vBulletin Plugins
    ____________________________________


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •