[thelist] check for existence of window by name?

Cymbala, Greg Greg.Cymbala at Den.Galileo.com
Mon Mar 25 11:35:01 CST 2002

Try this in a page:

var newWindow;

// Try uncommenting/commenting the following line:

function testWindow()
	if (newWindow)
		if (newWindow.closed)
			alert("Not open.  Opening it.");
			alert("It's open!");
		alert("Window was never opened.  Opening it.");

function openNewWindow()
	newWindow = window.open("http://www.google.com", "myNewWindow");

<P><input type="button" onclick="testWindow()" value="Test" /></P>

-----Original Message-----
From: AtdtXav [mailto:atdtxav at yahoo.com]
Sent: Monday, March 25, 2002 10:27 AM
To: thelist at lists.evolt.org
Subject: RE: [thelist] check for existence of window by name?

Hi Andy, I have to wonder if you work in Farmington Hills, as I worked for
CPWR for three years. ;)

Will window.closed return true or false for a window that was never opened?
if true, that's exactly what I need.  If false, I'm afraid it's square one.
maybe something as simple as "if exist(QT)"?  I'm new to the DOM, I'm


--- "Hardacker, Andrew" <Andrew.Hardacker at Compuware.com> wrote:
> <snip>
> What I'm trying to figure out is whether something like 'if
> window.name == QT' will work... only problem is I think that only
> refers to the current window, and I just want to know if it
> is open at all.
> </snip>
> Scott, have you tried checking the window's "closed" property?
> if (myWindow.closed)
>   // open a new instance of myWindow
> else
>   // update myWindow
> Andy Hardacker

The information in this electronic mail message is sender's business
Confidential and may be legally privileged.  It is intended solely for the
addressee(s).  Access to this Internet electronic mail message by anyone
else is unauthorized.  If you are not the intended recipient, any
disclosure, copying, distribution or any action taken or omitted to be taken
in reliance on it is prohibited and may be unlawful.
The sender believes that this E-mail and any attachments were free of any
virus, worm, Trojan horse, and/or malicious code when sent. This message and
its attachments could have been infected during  transmission. By reading
the message and opening any attachments, the recipient accepts full
responsibility for taking protective and remedial action about viruses and
other defects. Galileo International is not liable for any loss or damage
arising in any way from this message or its attachments.

More information about the thelist mailing list