Results 1 to 2 of 2

Thread: need a pop on close window

  1. #1
    Join Date
    Aug 2011
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default need a pop on close window

    I need a message appear on pop up when user try to close window. I tried close.window() but that is not working for mozilla.

  2. #2
    Join Date
    Mar 2007
    Location
    New York, NY
    Posts
    557
    Thanks
    8
    Thanked 66 Times in 66 Posts

    Default

    Events when a window is being closed is handled by the onbeforeunload event.

    Code:
    function confirmClose() {
        if (confirm("This is an confirm box.")) {
          parent.close();
        }
        else
          // User does not want to close the window.
     {
        }
    }
    
    window.onbeforeunload = confirmClose();

Bookmarks

Posting Permissions

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