[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: How to know that a window is still open
We at The Obscure Organization have been trying to tune majordomo, and
the 'let only members post to the list' option is making a good portion
of the submissions bounce. This happens because a user subscribed to the
list using one email address, say, email@example.com, but is sending
mail messages with a mail user agent (like pine or Zmail) that puts out
a return address of firstname.lastname@example.org.
I will forward bounced messages that are relevant and topical to the
list here for now, and open up the access controls again so that the
list is not posting-restricted to the exact email addresses that are on it.
---------- Forwarded message ----------
From: email@example.com (Athomas Goldberg)
Date: Mon, 11 Mar 1996 20:02:12 -0500
In-Reply-To: Martin Senger <M.Senger@dkfz-heidelberg.de>
"How to know that a window is still open" (Mar 11, 15:26)
Subject: Re: How to know that a window is still open
Unfortunately window.open() is perhaps the buggiest of the commonly used JS
methods. The URL parameter frequently fails to load, and only the height and
width windowFeatures currently function. Until they fix things, the following
SHOULD (I hope) give you what you're looking for.
foo = window.open("http://whatever","some_name","SomeFeatures");
foo.location = "http://whatever"
if you don't set foo.location, the URL may not load (don't ask me why)
and when it comes time to close the durned thang:
This should be done from the parent window (the one that opened the new
Alternately, the following should also work if what you want to do is destroy a
window if its been spawned, but keep it if it's the top window.
When you create the window:
<a href = "http://SomeURLorAnother"
onClick = "window.open('http://SomeURLorAnother',
target = 'windowName';"
Obligatory Clickable Text
When you destroy the window:
var wname = top.name;
if (wname == 'windowName') top.close();
This will check to see if the window was spawned and then loaded with said URL
or if the URL was loaded directly into the initial browser window, (in which
case we don't destroy it) This must be done from said URL and not some other
For an example of this see:
http://www.mrl.nyu.edu/athomas/Artwork.html and click on "ATG's Gallery
of (Semi) Recent Works"
Then look at:
In the first case, clicking on the link closes the parent window and opens a
new one with the gallery.
In the second case, the gallery is loaded into the startup browser.
In both cases, clicking on the small tiger-head button on the bottom loads my
Homepage, but in the first case, it destroys the spawned window and opens a new
"default-like" browser. In the second case, my Homepage is just loaded into
the browser window.
There seems to be some confusion here as to what "top" refers to. When you
access the methods and variables of "top" (like close() for instance) you're
actually referring to the topmost DOCUMENT in THAT window, not to be confused
with "parent" which refers to the DOCUMENT which is the parent of this Document
(as in frames). Note: neither of these refers to another window. Other
windows can only be referred to by the names you assign them (the second
technique) or by their object names (the first technique), and only in ways
similar to those I've described.
Both techniques are, perhaps, considerably more involved than they need to be,
but hopefully this will all be resolved in future releases of Netscape.
On Mar 11, 15:26, Martin Senger wrote:
> Subject: 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>'
> 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)?
> | Martin Senger firstname.lastname@example.org |
> | voice: (0049) 6221/422340 |
> | fax: (0049) 6221/422333 |
Associate Research Scientist
New York Univerity
Media Research Lab ph: (212) 998-3469
715-719 Broadway rm 1227 fx: (212) 995-4122
New York NY 10003
For help about the list, please send a message to 'email@example.com'
with the message body 'help'. To unsubscribe, send a message to