Developer

Open cascading windows

With JavaScript, you can open more than one window consecutively. Here's how.

By Brent Lee Metcalfe

In addition to opening windows simultaneously, you can open more than one window consecutively. Suppose you build a site whose initial HTML file launches two subwindows from the main browser. The first subwindow could function as the primary information display, the second as a navigational device. This would allow users the option of closing the main browser, giving Web builders control over all navigational elements.

Each window is the parent (or opener) of the subwindow that opens after it. Pop-up 1 is launched from the main browser. Pop-ups 2 through 4 open when the preceding subwindow loads. The code below, for example, opens Pop-up 2 from the Pop-up 1 HTML file:

<script language="javascript">
<!—
var no2 = null;

function cascade2() {
  no2 = window.open('cascade2.html','cas2','dependent,width=175,height=175,left=20,top=20');
}
//—>
</script>

<body … onLoad="cascade2()" … >

Brent Lee Metcalfe is a Web architecture consultant.

Editor's Picks