Results 1 to 2 of 2

Thread: Detecting if window exists

  1. #1
    Join Date
    Nov 2002

    Detecting if window exists

    is there a way to detect if a window exists with javascript?

    i need to execute a function when a certain window has been closed.

    thanks in advance

  2. #2
    Join Date
    Nov 2002
    You can only detect a window if:
    1) you know the name of the window, or
    2) you have a pointer to the window because you opened it, or
    3) you are in a child window and you want to know about your opener.

    Even if you know the name, you still need a pointer. You can get a pointer to a window called "theName" using:

    var myWin = window.open("", "theName");

    Unfortunately, if the window does not exist, this will open a new empty window.

    Once you have a pointer, you can test if the window is closed:

    if (myWin.closed) ...

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