Find any open windows from different parents

J

J.R

I'm trying to determine if a named child window has been opened before
opening a new one, however my challenge is that the child window may have
been opened from a parent that no longer exists, therefore there is no
access to the child window handle. Any ideas?

Thanks All.
 
G

Grant Wagner

J.R said:
I'm trying to determine if a named child window has been opened before
opening a new one, however my challenge is that the child window may have
been opened from a parent that no longer exists, therefore there is no
access to the child window handle. Any ideas?

Thanks All.

Just call window.open() with the same 2nd parameter (window name) as before.
If the window is currently open, the content will be directed to it, if it's
not open, it will be opened and the content loaded.

--
| Grant Wagner <[email protected]>

* Client-side Javascript and Netscape 4 DOM Reference available at:
*
http://devedge.netscape.com/library/manuals/2000/javascript/1.3/reference/frames.html

* Internet Explorer DOM Reference available at:
*
http://msdn.microsoft.com/workshop/author/dhtml/reference/dhtml_reference_entry.asp

* Netscape 6/7 DOM Reference available at:
* http://www.mozilla.org/docs/dom/domref/
* Tips for upgrading JavaScript for Netscape 6/7 and Mozilla
* http://www.mozilla.org/docs/web-developer/upgrade_2.html
 
J

J.R

Thank you for your reply Grant.

Yes, it does replace the named window using the method you suggested,
however when I check my window object reference opened by the now non
existent parent with the following code
WinObj = window.open(
theUrl,winName,'scrollbars=no,resizable=no,top=0,left=0,width=740,height=500
' );

WinObj does not any longer contain the windows handle, at least not
recognized by the new parent when I check as follows,

if(window.WinObj == null)

and what I need to do is intercept this and respond to the user.

Any thoughts?

Thanks again, John.
 
G

Grant Wagner

Well, if page1.html calls WinObj = window.open(..., "TheName", ...), then the browser
containing page1.html is closed, of course your window reference will be lost.

So the solution is to do WinObj = window.open(..., "TheName", ...) on page2.html. You
will now have a new reference to the same window you opened before (or if the window
didn't exist, it will be opened and you will have a reference to that newly opened
window).

J.R said:
Thank you for your reply Grant.

Yes, it does replace the named window using the method you suggested,
however when I check my window object reference opened by the now non
existent parent with the following code
WinObj = window.open(
theUrl,winName,'scrollbars=no,resizable=no,top=0,left=0,width=740,height=500
' );

WinObj does not any longer contain the windows handle, at least not
recognized by the new parent when I check as follows,

if(window.WinObj == null)

and what I need to do is intercept this and respond to the user.

Any thoughts?

Thanks again, John.

--
| Grant Wagner <[email protected]>

* Client-side Javascript and Netscape 4 DOM Reference available at:
* http://devedge.netscape.com/library/manuals/2000/javascript/1.3/reference/frames.html
* Internet Explorer DOM Reference available at:
* http://msdn.microsoft.com/workshop/author/dhtml/reference/dhtml_reference_entry.asp
* Netscape 6/7 DOM Reference available at:
* http://www.mozilla.org/docs/dom/domref/
* Tips for upgrading JavaScript for Netscape 7 / Mozilla
* http://www.mozilla.org/docs/web-developer/upgrade_2.html
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,079
Messages
2,570,573
Members
47,205
Latest member
ElwoodDurh

Latest Threads

Top