Home Articles FAQs XREF Games Software Instant Books BBS About FOLDOC RFCs Feedback Sitemap

Q513 How can you target the opener window by name using a normal HTML link?

You are here: irt.org | FAQ | JavaScript | Window | Q513 [ previous next ]

The actual main window does not have a name by default, its blank. In the older browsers (Netscape Navigator 2 and Internet Explorer 3) you cannot alter the windows name property as its read only, however in the later browsers (Netscape Navigator 3 and Internet Explorer 4) you can, You can then use the name you've given to the main browser in other windows to target the link. In the main window:

<script language="JavaScript"><!--
if (document.images)
    self.name = 'mainwindow';

Then in the navigation window:

<a href="bpage.html" target="mainwindow">Text Link</a>

There is nothing to actually stop you naming the opener window directly from the popup window:

<a href="bpage.html" target="openerwindow" onClick="if (document.images) opener.name='openerwindow'">Text Link</a>

©2018 Martin Webb