Targeting Windows: Relationships Between Windows |
Since a hyperlink in one window can create a new window, it seems natural to call the first window the "parent window" and the second window the "child window." Unfortunately, with Netscape's current frame specification, this relationship does not exist.
Consider this example. Suppose we have two documents, parent.html and child.html, who source code is as follows:
parent.html |
child.html |
Now, if you were paying attention in the previous sections, then you would guess that clicking on parent.html's link would create a new, unnamed window, and display child.html in it. Now, here's where your intuition might fail you. What will happen when the user selects the link "LOAD PARENT WINDOW" from the new window? Since the target in this hyperlink is _parent
, shouldn't that signal to the browser that the other window, the current window's creator, should be updated?
Unfortunately, the answer is "no". The target name _parent
refers not to the parent window, but to the parent frame. Since the second window has only one frame, that frame is its own parent. (How sick!) In this case, specifying _parent
as the hyperlink target has no meaning, and the browser will simply ignore the target. This means that so-called "child windows" (remember that technically there is no such thing) cannot update their "parent windows" unless they refer to them by name. (And if you've ever called your parents by name, you know how well that goes!)
For all practical purposes, then, all windows exist on the same level, regardless of the who created whom. They are neither parent nor child, and it is useless to use such terms as "parent window" or "child window," unless Netscape changes their frame language to allow such relationships.
(Recently, there have been some JavaScript innovations that actually allow a new popup window to determine which window created it. So in the JavaScript world, parent windows and child windows do exist -- just not in the frames world.)
-- End of Lesson 3 --
[ menu | previous page ]