how to check if a popup is close?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • perhapscwk
    New Member
    • Sep 2007
    • 123

    how to check if a popup is close?

    how to check if a popup is close?

    thanks.
  • acoder
    Recognized Expert MVP
    • Nov 2006
    • 16032

    #2
    Use the window.closed property:
    Code:
    if (!win || win.closed) {
    // window closed...
    }

    Comment

    • perhapscwk
      New Member
      • Sep 2007
      • 123

      #3
      no matter the popup is open or closed...the alert still never run..
      why?

      thanks a lot.

      Code:
       
      win =window.open("fillsn.htm", "name", "width=600,height=600");
       
      if (!win || win.closed) {
      alert("closed");
      }

      Comment

      • acoder
        Recognized Expert MVP
        • Nov 2006
        • 16032

        #4
        Again, there's not enough time for it to register. Use a button:
        Code:
        <input type="button" value="Is it closed?" onclick="isClosed();">

        Comment

        Working...