Window Spawning and Remotes: Window Attributes - Doc JavaScript | WebReference

Window Spawning and Remotes: Window Attributes - Doc JavaScript


Window Attributes

As you may recall, the third parameter of the window.open() method is a comma-separated list specifying window ornaments to display. The supported features are:

alwaysLowered=[yes|no|1|0] (Navigator 4.0 only)
Specifies whether to create a new window that floats below other windows, whether it is active or not. This is a secure feature and must be set in signed scripts.
alwaysRaised=[yes|no|1|0] (Navigator 4.0 only)
Specifies whether to create a new window that floats on top of other windows, whether it is active or not. This is a secure feature and must be set in signed scripts.
channelmode=[yes|no|1|0] (Internet Explorer 4.0 only)
Specifies whether to display the window in theater mode and show the channel band.
dependent=[yes|no|1|0] (Navigator 4.0 only)
Specifies whether to create a new window as a child of the current window. A dependent window closes when its parent window closes. On Windows platforms, a dependent window does not show on the task bar. It also has a narrow title bar, and a smaller "x" button to close the dependent window.
directories=[yes|no|1|0]
Specifies whether to create the standard browser directory buttons. In some browsers the directory buttons can be customized by the user.
fullscreen=[yes|no|1|0] (Internet Explorer 4.0 only)
Specifies whether to display the browser in a full-screen or normal window. Use Alt+F4 to close the window.
height=number
Specifies the height of the window in pixels. The minimum value should be 100.
hotkeys=[yes|no|1|0] (Navigator 4.0 only)
Specifies whether to enable most hotkeys in a new window that has no menu bar. The security and quit hotkeys remain enabled in any case.
innerHeight=number (Navigator 4.0 only)
Specifies the height, in pixels, of the window's content area. A signed script is required to create a window smaller than 100 x 100 pixels. This feature replaces height, which remains for backwards compatibility.
innerWidth=number (Navigator 4.0 only)
Specifies the width, in pixels, of the window's content area. A signed script is required to create a window smaller than 100 x 100 pixels. This feature replaces width, which remains for backwards compatibility.
location=[yes|no|1|0]
Specifies whether to display the Location field, the input field for entering URLs directly into the browser.
menubar=[yes|no|1|0]
Specifies whether to create the menu at the top of the window. In Internet Explorer, this feature is yes by default. A menu normally consists of a "File" option, an "Edit" option, and other browser-specific options.
outerHeight=number (Navigator 4.0 only)
Specifies the vertical dimension, in pixels, of the outside boundary of the window. A signed script is required to create a window smaller than 100 x 100 pixels.
outerWidth=number (Navigator 4.0 only)
Specifies the horizontal dimension, in pixels, of the outside boundary of the window. A signed script is required to create a window smaller than 100 x 100 pixels.
resizable=[yes|no|1|0]
Specifies whether to display resize handles at the corners of the window, which enable the user to resize the window. If this feature is not turned on explicitly, the user cannot resize the new window.
screenX=number (Navigator 4.0) left=number (Internet Explorer 4.0)
Specifies the distance the new window is placed from the left side of the screen. In Navigator, to place a window offscreen, set this feature in a signed scripts.
screenY=number (Navigator 4.0) top=number (Internet Explorer 4.0)
Specifies the distance the new window is placed from the top of the screen. In Navigator, to place a window offscreen, set this feature in a signed scripts.
scrollbars=[yes|no|1|0]
Specifies whether to display horizontal and vertical scroll bars, when the content exceeds the dimensions of the window. This feature is yes by default.
status=[yes|no|1|0]
Specifies whether to create a status bar at the bottom of the window. In Internet Explorer, this feature is yes by default.
titlebar=[yes|no|1|0] (Navigator 4.0 only)
Specifies whether to create a window with a title bar at the top. This feature is yes by default, but can be set to no in a signed script.
toolbar=[yes|no|1|0]
Specifies whether to display the browser toolbar, with buttons such as Back and Forward.
z-lock=[yes|no|1|0] (Navigator 4.0 only)
Specifies whether to create a new window that does not rise above other windows when activated. This is a secure feature and must be set in signed scripts.
width=number
Specifies the width of the window in pixels. The minimum value should be 100.

Many of these features can be either yes or no, 1 or 0. Alternatively, if you want to turn a feature on, you can simply specify the feature name in the comma-separated list.

How the alwaysLowered, alwaysRaised, and z-lock features behave depends on the windowing hierarchy of the platform. For example, on Windows, an alwaysLowered or z-locked browser window is below all windows in all open applications. On Macintosh, an alwaysLowered browser window is below all browser windows, but not necessarily below windows in other open applications. Similarly for an alwaysRaised window.

For compatibility reasons, you should always specify each feature explicity. Use the following interactive form to construct a script segment that launches a window with specified features:

channelmode dependent
directories fullscreen
location menubar
resizable scrollbars
status toolbar
height width
innerHeight innerWidth
outerHeight outerWidth
screenX and left screenY and top
newURL newName
orgName varName

In case your browser doesn't support JavaScript, here's an example of the required script:

<SCRIPT LANGUAGE="JavaScript">
<!--
// Copyright (c) 2000 internet.com Corp.
// https://www.webreference.com/js/
// License is granted if and only if this entire
// copyright notice is included. By Tomer Shiran.
function launch(newURL, newName, newFeatures, orgName) {
  var remote = open(newURL, newName, newFeatures);
  if (remote.opener == null)
    remote.opener = window;
  remote.opener.name = orgName;
  return remote;
}
function launchRemote() {
  myRemote = launch("https://www.webreference.com/js/column7/demo.html",
                    "myRemote",
                    "height=350,width=110,alwaysLowered=0,alwaysRaised=0,
                       channelmode=0,dependent=0,directories=0,fullscreen=0,
                       hotkeys=1,location=0,menubar=0,resizable=0,scrollbars=0,
                       status=0,titlebar=1,toolbar=0,z-lock=0",
                    "myWindow");
}
// -->
</SCRIPT>

Note that this form does not check if your input is valid. Thus, you should read the description of each feature. Also note that there are too many variations to cover, so you should test your script on several browsers. For example, some features override others, but only in some browsers, so it would be impossible to cover all of the possibilities. Simply try it out and see if it does what you want. If you want to be on the safe side, do not use features that are not supported by all browsers and versions.

Another important point is that features that require a signed script should not be used in a regular one. Some browsers, such as the Mac version of Netscape Navigator 4.0x, generate a JavaScript error when that is done. The problematic features are:

alwaysLowered=1|yes
alwaysRaised=1|yes
hotkeys=0|no
titlebar=0|no
z-lock=1|yes

After generating the code with the preceding form, copy and paste it in the <HEAD>...</HEAD> portion of your document. Then invoke the function with an event handler, a button, or a link (text or image):

<BODY onLoad="launchRemote()">
<FORM>
<INPUT TYPE="button" VALUE="launch" onClick="launchRemote()">
</FORM>
<A HREF="javascript:launchRemote()">...</A>

https://www.internet.com

Created: November 18, 1997
Revised: December 4, 1997
URL: https://www.webreference.com/js/column7/attributes.html