www.webdeveloper.com
Results 1 to 8 of 8

Thread: Response To The 'X' click - Thanks !

  1. #1
    Join Date
    Jun 2004
    Posts
    9

    Response To The 'X' click - Thanks !

    I need your help.

    Is there a method or event that response to the user clicking on the 'X' of the browser?

    I know that Session_End gets called, but it doesn't get called immediately after the user clicks on the 'X'. It'll only fires when the session has expired.

    Thanks in advance for your replies !

  2. #2
    Join Date
    Nov 2002
    Location
    Auburn, AL
    Posts
    9,222
    Nope, because when the user clicks the browser windows the page is not resent to the server, so the server does not get told when the user clicks the x, so there is nothing you can do. You can use a javascript on page close to do something client side, but you will not be able to communicate with the server though this.

  3. #3
    Join Date
    Jun 2004
    Posts
    9
    Thanks for your reply.

    You're right.

    But since I just found a solution, I might as well share it with everyone else.

    I would create the onUnload event handler, which calls a function (javascript) to open a window which runs your server-side stuffs. Then closes the new window.

    This particular trick works for me.

    Anyways, appreciate your reply !

  4. #4
    Join Date
    Nov 2002
    Location
    Auburn, AL
    Posts
    9,222
    Thats pretty cleaver, and that js window is only open for a split second, does the user even see it?

  5. #5
    Join Date
    Jun 2004
    Posts
    9
    very faint. You hardly notice it.

    But I haven't tested it on different platforms or machines.

    I have a WinXP Pro 3.2GHz and 1.0 GB RAM

  6. #6
    Join Date
    Nov 2002
    Location
    Auburn, AL
    Posts
    9,222
    Originally posted by ank2go
    very faint. You hardly notice it.

    But I haven't tested it on different platforms or machines.

    I have a WinXP Pro 3.2GHz and 1.0 GB RAM
    eh, darn you running 200mhz faster then me at the moment, Let me bust out the motherboard monitor and change that. You build your system yourself?

  7. #7
    Join Date
    Jun 2004
    Posts
    9
    Originally posted by PeOfEo
    eh, darn you running 200mhz faster then me at the moment, Let me bust out the motherboard monitor and change that. You build your system yourself?
    Sorry. Actually, it's a work puter. I don't really put a whole system together, but once it's together I can troubleshoot on my own.

    Do you code in VB.NET or C#?

  8. #8
    Join Date
    Nov 2002
    Location
    Auburn, AL
    Posts
    9,222
    mainly vb.net, I am more comfortable with the syntax, but if I were required to code in c# for a job or something I could probably make do (it might require a bit of learning for more advanced stuff since I never use c#).

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles