A means of creating new windows under script control.


JavaScript - 1.0
JScript - 1.0
Internet Explorer - 3.02
Netscape - 2.0
Opera - 3.0
Property/method value type:Window object
JavaScript syntax:-aNewWindow =
-aNewWindow =
-aNewWindow =, aName)
-aNewWindow =, aName, aFeatureList)
-aNewWindow =, aName, aFeatureList, aFlag)
-aNewWindow = open()
-aNewWindow = open(aURL)
-aNewWindow = open(aURL, aName)
-aNewWindow = open(aURL, aName, aFeatureList)
-aNewWindow = open(aURL, aName, aFeatureList, aFlag)
Argument list:aFeatureListA list of attributes for the new window
aFlagA flag to indicate how the history list is to be modified
aNameThe name of a new or existing target window
aURLA URL to load into the window

All arguments are optional. However, since they are also positional, you must use commas and empty strings as necessary to null out the entries you don't require if you need the later ones.

The URL value, if specified, will fetch and load the document into the window as the method is executed. You may omit or null the URL with an empty string. This will open a new window but not load anything into it.

The name identifies the target window. If that window name is not already used, then a new window will be created, otherwise the URL will replace the existing content. When you direct a null URL to an already open window being referenced by name just returns a reference to that window object. This may be useful if you know the name of a window but do not have a handle on its object representation. If you do not specify a name, then a new unnamed window will be created.

The feature list describes the attributes of the window. This may in some implementations allow you to change a window's appearance but this may not always be possible. The feature list must be comma separated and must not contain any spaces.

The flag value indicates what you want done with the history table for this window. Passing the Boolean true value indicates that the new URL should replace the existing history entry. A Boolean false value indicates that the new URL should be added to the tail of the history list. This facility is available from JavaScript version 1.1 onwards.

The value returned by this open() method is a reference to the window object that represents the window that has just been opened. You can store this in a variable so you can send messages to the window when necessary.

See the Window features list topic for a list of the window feature names and the values that they expect, and a discussion on the limitations and some subtle catch-outs and differences between the browsers.

This method returns a reference to the window object for the window that was created or updated. You should note this in some persistent variable if you plan to communicate with the window some time later during the session.


See, EventCapturer object, Frame object, JellyScript, Window feature list, Window object, Window.close(),, Window.opener


Wrox Instant JavaScript - page - 74