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

Re: How to recognize the 'last' window?



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

Top level windows created when the browser first opens or with File, New
Browser never have a name.  This methd  not close *all* open windows except
one, but it should be useful for closing all windows opened by you.

-- Gordon


At 10:01 AM 3/8/96 +0100, you wrote:
>Does anybody know how to check if I am in the topmost window?
>
>The idea behind is:
>   I have a 'close' button in my document with _self.close() function.
>   But I do not want to call this function in case when I am in the last
>   browser window.   It would exit the whole Navigator and that I is not
>   what I want. So something like that would suit me:
>   function closeConditionally() {
>       if (there-are-more-open-windows) _self.close()
>       else return;
>
>Thanks for answers
>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/
>
>

--------------------------------------------------------------------
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/