Window.open() MethodNameWindow.open() Method---open a new browser window or locate a named windowAvailabilityNavigator 2.0, Internet Explorer 3.0; enhanced in Navigator 3.0 Synopsis
window.open(url, name, [features, [replace]]) Arguments
ReturnsA reference to a Window object, which may be newly created, or to an already existing one. DescriptionThe open() method looks up an already existing window or opens a new browser window. If the name argument specifies the name of an existing window, then a reference to that window is returned. The returned window will display the URL specified by url, but the features argument will be ignored. This is the only way in JavaScript to obtain a reference to a window which is known only by name. If the name argument is not specified, or if no window with that name already exists, the the open() method creates a new browser window. The created window displays the URL specified by url, has the name specified by name, and has the size and controls specified by features (the format of this argument is described below). If url is the empty string, then open() opens a blank window. The name argument specifies a name for the new window. This name may only contain alphanumeric characters and the underscore character. It may be used as the value of the TARGET attribute of an <A> or <FORM> tag in HTML, to force documents to be displayed in the window. With Navigator 3.0, when you use Window.open() to load a new document into a named window, you can also use the replace argument to specify whether the new document will have its own entry in the window's browsing history, or whether it will replace the history entry of the current document. If replace is true, the new document will replace the old. If this argument is false is or not specified, then the new document will have its own entry in the Window's browsing history. This argument provides functionality much like that of the Location.replace() method. The features argument is a comma-separated list of features to appear in the window. If this optional argument is empty or not specified at all, then all features will be present in the window. On the other hand, if features specifies any one feature, then any features that do not appear in the list will not appear in the window. The string should not contain any spaces or other whitespace. Each element in the list has the format:
feature[=value] For most features, the value is yes or no. For these features, the equals sign and the value may be omitted--if the feature appears, yes is assumed, and if it doesn't no is assumed. For the width and height features, the value is required and must specify a size in pixels. The available features and their meanings are listed below. Note, however, that on X11 platforms in Navigator 2.0, only the width and height features work, and new browser windows are not created with any of the standard controls, even when the features argument is omitted entirely.
Don't confuse this Window.open() method with the document.open() method; the two perform very different functions. For clarity in your code, you may want to use window.open() instead of open(). (Recall that the window property is simply a way to explicitly refer to the current window.) BugsIn Navigator 2.0, on X11 and Macintosh platforms, the url argument is ineffective. The solution is to call open() once to create the window, and then call it again to set the URL, or better, to use location property of the new (blank) window to load the desired URL. On X11 platforms in Navigator 2.0, only the width and height features work, and new browser windows are not created with any of the standard controls, even when the features argument is omitted entirely. |
|