[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

How to know that a window is still open



Few days ago I asked how to recognize that a given window is
the topmost window, the 'last' one of all open Navigator windows.

Gordon replied that "...Top level windows created when the browser 
first opens or with File, New Browser never have a name....". That's
clear. So I wanted less: just to be able to close the windows which I opened
from my JS. It seemed to be very simple - let me again guote Gordon:

Off the top of my head: If you open the window and pass it a name, like this:

        window.open ("blah.html", "win1");

then it will have a name.  You can test for the name with

        if (window.name !="")
                 you're in the top window

But, it doesn't work. I tried to display window.name (exactly in this
example window.win1) with alert and always I'v got '<undefined>'
value.

Does somebody know how to to this simple task? And can it be done
in a way that I can close also windows not opened by my JS but
those whose name I know (because I specified 'target' when calling them)?

Thanks. 
Martin.

------------------------------------------------------
| Martin Senger     m.senger@dkfz-heidelberg.de      |
|                   voice: (0049) 6221/422340        |
|                   fax:   (0049) 6221/422333        |
------------------------------------------------------
--------------------------------------------------------------------
For help about the list, please send a message to 'majordomo@obscure.org'
with the message body 'help'. To unsubscribe, send a message to
'majordomo@obscure.org' with the message body 'unsubscribe javascript'.
List archives and pointer to FAQ: http://www.obscure.org/javascript/