[thelist] Parent and Child Windows

Joshua Olson joshua at waetech.com
Fri Feb 27 10:06:31 CST 2004

> From: Richard Morris
> Sent: Friday, February 27, 2004 10:59 AM
> But what script do I need to be able to get the original window to display
> the contents of an 'internal' hyperlink? i.e. Window 1 displays
> Page A which
> spawns Window 2 Page B and clicking on a hyperlink here loads Page C in
> Window 1 (and even closes Window 2?).


In a popup window, the object "opener" is a reference to the parent window.
You should be able to pass this object around the various windows to
maintain the reference to the first window.

<tip type="JS Best Practice" author="Joshua Olson">
When opening windows via links using JS, use the following format to promote
accessibility and graceful degradation:

<a href="somepage.html" target="_blank" onclick="window.open(this.href,
this.target, '[ attributes]'); return false;" title="[The link
description] - Opens in a new window">open link in new window</a>

Using this technique allows the new content to be viewed in a new window
even in non-JS enabled browsers.

Joshua Olson
Web Application Engineer
WAE Tech Inc.

More information about the thelist mailing list