www.webdeveloper.com
Results 1 to 2 of 2

Thread: Closing WEB from X-top-right not firing .unload

  1. #1
    Join Date
    Aug 2012
    Posts
    1

    Closing WEB from X-top-right not firing .unload

    Don't know if I'm missing something here or if I screwed it up.

    But on the pop up window I'm working on I have a control (button) for closing the window.
    What I want to do is to be able to have control over the X on the top right corner of the screen so I can trigger a little C# code before actually saying goodbye to the pop up.

    this example
    Code:
    $(window).unload( function () { alert("Bye now!"); } );
    is firing when I hit my own button for closing the window:
    but it's definetely not when I hit the X button. (tried traditional javascript and it's the same)

    Any ideas?

  2. #2
    Join Date
    Dec 2007
    Location
    's-Hertogenbosch, the Netherlands
    Posts
    28
    Closing a browser window is not considered 'unloading'. If you were to navigate from your page to another page, unload would fire.

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