The feature list defines how the new window that is to be created will appear. For example, you can control the appearance of the various window adornments.
The features are generally presented as a name-value pair, thus:
name=value
The features are either available for use as simple switches and will control the functionality depending on whether they are present or not. Some also support an optional value while others require a mandatory value. Features requiring a mandatory value are generally numeric in nature.
The switching values may be "yes" or "1" to enable a feature and "no" or "0" to disable a feature. Switching features can be used with no associated value. This will generally default to "yes".
As you would expect, MSIE and Netscape Navigator support a completely different and incompatible set of features. Even controlling the same attribute of the window may require different feature names to be used (dor example width in MSIE and innerWidth/outerWidth in Netscape Navigator).
The feature names are case insensitive but good style dictates that they are specified as shown in the table.
Here is a summary of the available features of a window.open() method:
Feature | Value | NNav | MSIE | Description |
---|---|---|---|---|
alwaysLowered | - | 4 | No | This dictates that a window should always be at the bottom of the stack of windows. |
alwaysRaised | - | 4 | No | This dictates that a window should always be at the top of the stack of windows. |
channelMode | - | No | 4 | Controls whether the window is presented in channel mode. |
dependent | Yes/No | 4 | No | If a window is not dependent, it can survive after its creator has been closed. |
directories | Yes/No | 4 | No | Controls the appearance of the Netscape Navigator personal toolbar. |
fullscreen | - | No | 4 | On the Windows platform, MSIE will fill the screen with the window. |
height | Number | 2 | 4 | This will set the window to the height value. |
hotkeys | Yes/No | 4 | No | Setting this value to "no" will disable most keyboard shortcuts apart from the quit option. |
innerHeight | Number | 4 | No | This will set the window to the height value measured inside the window border. |
innerWidth | Number | 4 | No | This will set the window to the width value measured inside the window border. |
left | Number | 4 | 4 | The left edge of the window will be positioned N pixels from the left edge of the screen. |
location | Yes/No | 2 | 4 | The location bar is visible. |
menubar | Yes/No | 2 | No | The menubar is fully populated with menus and menu items. |
outerHeight | Number | 4 | No | This will set the window to the height value measured outside the window border. |
outerWidth | Number | 4 | No | This will set the window to the width value measured outside the window border. |
resizable | Yes/No | 2 | 4 | The window displays resize facilities according to the switch value. |
screenX | Number | 4 | No | An alternative name for the left feature. |
screenY | Number | 4 | No | An alternative name for the top feature. |
scrollbars | Yes/No | 2 | 4 | Scroll bars are explicitly displayed according to the switch value. |
status | Yes/No | 2 | 4 | The window displays a status bar according to the switch value. |
toolbar | Yes/No | 2 | 4 | The window displays a toolbar according to the switch value. |
top | Number | 4 | 4 | The top edge of the window will positioned N pixels from the top edge of the screen. |
width | Number | 2 | 4 | This will set the window to the width value. |
z-lock | - | 4 | No | This dictates that a window should always be at the same z-position in the stack of windows. |
The following z-order feature switch values require the UniversalBrowserWrite privilege to be enabled when they are used in Netscape Navigator:
alwaysLowered
alwaysRaised
hotKeys
z-lock
You must not include spaces in the feature list. If you do include spaces in the feature list attribute, the script may cause some versions of Netscape Navigator to crash horribly.
Specifying a new window with a call to window.open() that has no arguments results in a window that is completely unadorned in MSIE and one that has a full complement of furniture (location, toolbar, etc.) in Netscape Navigator. Specifying even a single feature means the browser will assume all others are deactivated.
For those features that require UniversalBrowserWrite privilege in Netscape Navigator, the time at which you request the feature may affect how the window is presented. This may be platform specific and Netscape Navigator may behave differently according to the UI rules and appearance of the hosting platform.
In Netscape Navigator, on the Macintosh platform, setting the alwaysLowered feature will place a window at the bottom of the Z stacking order. That window will be permanently inactive as long as another window is open. It will be styled as a normal window. If the alwaysRaised feature is applied, the window will be placed on top and will be permanently active. In addition, the style is changed to that of a floating dialog (a Windoid in Macintosh UI parlance). A floating dialog in the Macintosh has a slimmer window border and a window title bar that is not as thick as a normal window.
The fullscreen mode in the MSIE browser is not supported on the Macintosh platform.
If you specify dimensions for the window, you must specify both the horizontal and vertical values otherwise Netscape Navigator will ignore the setting. MSIE will happily take only one of the values and provide a default for the other. Netscape Navigator requires both height and width but doesn't care what sort. You can mix innerHeight and outerWidth or height and innerWidth for example.
Note that if the top or left values are specified on their own, the missing value will default to zero in both MSIE and Netscape Navigator.
The scrollbars feature forces scroll bars to be present or not according its value in both browsers. However, scroll bars appear automatically if needed on MSIE even if the scrollbars feature is omitted. On Netscape Navigator, they will only be available if you explicitly ask for them.
See also: | Window furniture, Window.open() |
Prev | Home | Next |
Window events | Up | Window furniture |
JavaScript Programmer's Reference, Cliff Wootton Wrox Press (www.wrox.com) Join the Wrox JavaScript forum at p2p.wrox.com Please report problems to support@wrox.com © 2001 Wrox Press. All Rights Reserved. Terms and conditions. |