Page Content

Complete cross-browser window.open() documentation

window.open( )

Creates a new secondary browser window and loads the referenced resource.

Syntax

WindowObjectReference = window.open(strUrl, strWindowName [, strWindowFeatures]);

Return value and parameters

WindowObjectReference
This is the reference pointing to the newly created browser window. This reference is the return value of the open() method; such reference will exist only if the window.open() instruction succeeded. A global variable is best used to store such reference. This window reference can be useful and is needed to access properties and methods of the new browser window.
strUrl
This is the URL to be loaded in the newly opened window. strUrl can be an HTML document on the web, it can be an image file or any type of file supported by the browser.
strWindowName
This is the string that just names the new window. Such string can be used to be the target of links and forms when the target attribute of an <a> element or of a <form> is specified. This string parameter should not contain any blank space. strWindowName does not specify the title of the new window.
strWindowFeatures
Optional parameter. This parameter is the string which lists the requested window features (window functionalities and toolbars) of the new browser window. This string parameter must not contain any blank space. Each requested window feature must be separated by a comma inside the character string.

[Page Content]

Description

The open method creates a new secondary browser window, similar to choosing New Window from the File menu. The strUrl parameter specifies the URL to be fetched and loaded in the new window. If strUrl is an empty string, then a new blank, empty window is created with all the default toolbars of the main window.

<script type="text/javascript">
var WindowObjectReference; /* Declaring a global variable
which will store a reference to the new window to be created */
function openRequestedPopup()
{
WindowObjectReference = window.open("http://www.cnn.com/", "CNN_WindowName",
"menubar=yes,location=yes,resizable=yes,scrollbars=yes,status=yes");
}
</script>
    
<script type="text/javascript">
var WindowObjectReference; // global variable
function openRequestedPopup()
{
WindowObjectReference = window.open("http://www.domainname.ext/path/ImageFilename.png",
"DescriptiveWindowName", "resizable=yes,scrollbars=yes,status=yes");
}
</script>
    

You can use the open method on an existing window, and if you pass the empty string for the URL, then you will get a reference to the existing window, but not load anything into it. You can then, for example, look for properties of that window or access its methods, assuming your code stores accordingly that returned window object reference and assuming that your main versus secondary window relationship complies with Same origin policy security requirements.

strWindowFeatures is an optional string containing a comma-separated list of requested features of the new window. After a window is opened, you can not use JavaScript to change the window functionalities and the window toolbars.

If strWindowName does not specify an existing window and if you do not supply the strWindowFeatures parameter (or if the strWindowFeatures parameter is an empty string), then the new secondary window will render the default toolbars of the main window.

If the strWindowFeatures parameter is used and if no size features are defined, then the new window dimensions will be the same as the dimensions of the most recently rendered window.
If the strWindowFeatures parameter is used and if no position features are defined, then the left and top coordinates of the new window dimension will be 22 pixels off from where the most recently rendered window was. An offset is universally implemented by browser manufacturers (it is 29 pixels in MSIE 6 with the default theme) and its purpose is to help users to notice new windows opening. If the most recently used window was maximized, then there is no 22 pixels offset: the new, secondary window will be maximized as well.

If you define the strWindowFeatures parameter, then the features that are not listed, requested in the string will be disabled or removed (except titlebar, close and hotkeys which are by default yes).

Tip: If you use the strWindowFeatures parameter, then only list the features you want to include in the new window, that you want to be enabled or rendered; the others (except titlebar, close and hotkeys) will be disabled, removed.

[Page Content]

There are 4 groups of windowFeatures which can be specified:

  1. Position and size features
  2. Toolbar and chrome features
  3. Window functionality features
  4. Features requiring enhanced security privileges
Legend of browser icons used
MSIE 7 and MSIE 8 for windows Firefox 2 or higher Opera 9 or higher

Position and size features

Note on position and dimension error correction
Bug 176320: Minimal innerWidth/innerHeight values for popup windows
Note on precedence

left

Specifies the distance the new window is placed from the left side of the work area for applications of the user's operating system to the leftmost border (resizing handle) of the browser window. The new window can not be initially positioned offscreen.

Supported in: MSIE 7+, Firefox 2+, Op 9+

top

Specifies the distance the new window is placed from the top side of the work area for applications of the user's operating system to the topmost border (resizing handle) of the browser window. The new window can not be initially positioned offscreen.

Supported in: MSIE 7+, Firefox 2+, Op 9+

height

Specifies the height of the content area, viewing area of the new secondary window in pixels. The height value includes the height of the horizontal scrollbar if present. The minimum required value is 100.
Note on outerHeight versus height (or innerHeight)

Supported in: MSIE 7+, Firefox 2+, Op 9+

width

Specifies the width of the content area, viewing area of the new secondary window in pixels. The width value includes the width of the vertical scrollbar if present. The width value does not include the sidebar if it is expanded. The minimum required value is 100.

Supported in: MSIE 7+, Firefox 2+, Op 9+

screenX

Deprecated. Same as left. Use left instead.

Supported in: Firefox 2+

screenY

Deprecated. Same as top. Use top instead

Supported in: Firefox 2+

outerHeight

Specifies the height of the whole browser window in pixels. This outerHeight value includes any/all present toolbar, window horizontal scrollbar (if present) and top and bottom window resizing borders. Minimal required value is 100.
Note: since titlebar is always rendered, then requesting outerHeight=100 will make the innerHeight of the browser window under the minimal 100 pixels.
Note on outerHeight versus height (or innerHeight)

Supported in: Firefox 2+

outerWidth

Specifies the width of the whole browser window in pixels. This outerWidth value includes the window vertical scrollbar (if present) and left and right window resizing borders.

Supported in: Firefox 2+

innerHeight

Same as height. Specifies the height of the content area, viewing area of the new secondary window in pixels. The innerHeight value includes the height of the horizontal scrollbar if present. Minimal required value is 100.
Note on outerHeight versus height (or innerHeight)

Supported in: Firefox 2+

innerWidth

Same as width. Specifies the width of the content area, viewing area of the new secondary window in pixels. The innerWidth value includes the width of the vertical scrollbar if present. The innerWidth value does not include the sidebar if it is expanded. Minimal required value is 100.

Supported in: Firefox 2+

[Page Content]

Toolbar and chrome features

If this feature is set to yes, then the new secondary window renders the menubar.
Mozilla and Firefox users can force new windows to always render the menubar by setting
dom.disable_window_open_feature.menubar
to true in about:config or in their user.js file.

Supported in: MSIE 7+, Firefox 2+

toolbar

If this feature is set to yes, then the new secondary window renders the Navigation Toolbar (Back, Forward, Reload, Stop buttons). In addition to the Navigation Toolbar, Mozilla-based browsers will render the Tab Bar if it is visible, present in the parent window.

Firefox users can force new windows to always render the Navigation Toolbar by setting
dom.disable_window_open_feature.toolbar
to true in about:config or in their user.js file.

Supported in: MSIE 7+, Firefox 2+

location

If this feature is set to yes, then the new secondary window renders the Location bar in Mozilla-based browsers.

Firefox users can force new windows to always render the location bar by setting
dom.disable_window_open_feature.location
to true in about:config or in their user.js file.

MSIE 7 forces the presence of the Address Bar by default:

"We think the address bar is also important for users to see in pop-up windows. A missing address bar creates a chance for a fraudster to forge an address of their own. To help thwart that, IE7 will show the address bar on all internet windows to help users see where they are."
coming from IE7 Blog, November 2005, Better Website Identification

As part of anti-phishing counter-measures, Firefox 3 now forces the presence of the Location Bar:
Bug 337344: Change default dom.disable_window_open_feature.location to true

Supported in: MSIE 7+, Firefox 2+, Op 9+

directories

If this feature is set to yes, then the new secondary window renders the Personal Toolbar in Firefox. It renders the Bookmarks Toolbar in Firefox and, in MSIE 7+, it renders the Links bar. In addition to the Personal Toolbar, Mozilla browser will render the Site Navigation Bar if such toolbar is visible, present in the parent window.

Firefox users can force new windows to always render the Personal Toolbar/Bookmarks toolbar by setting
dom.disable_window_open_feature.directories
to true in about:config or in their user.js file.

Supported in: MSIE 7+, Firefox 2+

personalbar

Same as directories but only supported in Mozilla-based browsers.

Supported in: Firefox 2+

status

If this feature is set to yes, then the new secondary window has a status bar. Users can force the rendering of status bar in all Mozilla-based browsers, in MSIE 7 (Note on status bar in XP SP2) and in Opera 9+. The default preference setting in recent Mozilla-based browser releases, in Firefox 2+ and in MSIE 7 is to force the presence of the status bar.
Note on status bar

Supported in: MSIE 7+, Firefox 2+

[Page Content]

Window functionality features

resizable

If this feature is set to yes, then it makes the new secondary window resizable.
Note: Mozilla-based browsers since version 1.4 will have a window resizing grippy at the right end of the status bar; this is to assure users that they can resize a browser window even when the web author explicitly or implicitly requested to make such secondary window non-resizable. In such case, the maximize/restore down system command icon in the titlebar will be disabled and window resizing borders will be unresponsive but the window will still be resizable via that window resizing grippy in the status bar.

Tip: For accessibility reasons, it is strongly recommended to always set this feature to yes.

Firefox users can force new windows to be easily resizable by setting
dom.disable_window_open_feature.resizable
to true in about:config or in their user.js file.

Firefox 3 makes by default all popup windows resizable:
Bug 177838: Make all popup windows resizable, ignoring resizable=no

Supported in: MSIE 7+, Firefox 2+

scrollbars

If this feature is set to yes, then the new secondary window renders scrollbar(s) if needed, only if content overflows requested window dimensions.

Tip: For accessibility reasons, it is strongly encouraged to always set this feature to yes.

Mozilla and Firefox users can force new windows to render scrollbar(s) when needed, when a document content overflow occurs by setting
dom.disable_window_open_feature.scrollbars
to true in about:config or in their user.js file.
Note on scrollbars

Supported in: MSIE 7+, Firefox 2+

dependent

If set to yes, the new window is said to be dependent of its parent window. A dependent window closes when its parent window closes. A dependent window is minimized on the Windows task bar only when its parent window is minimized. On Windows platforms, a dependent window does not show on the task bar. A dependent window also stays in front of the parent window.
dependent feature is not implemented on MacOS X.

The dependent feature is currently under revision to be removed (bug 214867)

The MSIE 7 almost equivalent to the dependent feature can be obtained by the recourse of the showModelessDialog( ) method. (bug 194404)

Supported in: Firefox 2+

dialog

The dialog feature removes the menu system commands (Restore, Minimize, Maximize) and its equivalent icons on the titlebar. You can access the command system menu with a right-click on the titlebar). Dialog windows are windows which have no minimize system command icon and no maximize/restore down system command icon on the titlebar nor in correspondent menu item in the command system menu. They are said to be dialog because their normal, usual purpose is to only notify info and to be dismissed, closed. On Mac systems, dialog windows have a different window border and they may get turned into a sheet.

Supported in: Firefox 2+

minimizable

This setting can only possibly apply to dialog windows. If minimizable is set to yes, then the new dialog window will have a minimize system command icon in the titlebar and it will be minimizable. If the new window is not a dialog window, then this setting has no impact on the presence of the minimize system icon in the titlebar. In practice, the minimizable window feature is rarely seen and very rarely necessary or useful since non-modal windows are all and always minimizable.

Supported in: Firefox 2+

fullscreen

Do not use. Not implemented in Mozilla. There are no plan to implement this feature in Mozilla.

fullscreen always upsets users with large monitor screen or with dual monitor screen. Forcing fullscreen on other users is also extremely unpopular and is considered as an outright rude attempt to impose the web author's viewing preferences onto the users.
Note on fullscreen

copyhistory

Deprecated. Do not use. Always implemented in Mozilla-based browsers. There are currently no plan to implement the copyhistory feature either.

hotkeys

Deprecated. Do not use. Always active in Mozilla-based browsers. There are currently no plan to implement the hotkeys feature either.

[Page Content]

Features requiring enhanced security privileges

The following features require the UniversalBrowserWrite privilege, otherwise they will be ignored. Chrome scripts have this privilege automatically, others have to request it from the Privilege Manager.

chrome

Note: This feature requires the UniversalBrowserWrite privilege (bug 244965). Without this privilege, the chrome feature is ignored.

If set to yes, the new window loads a window as its content. The new chrome window is not a normal browser window. chrome=yes will override scrollbars=no and will render scrollbars if needed. chrome=yes will ignore requests for standard toolbars like menubar, toolbar, location bar, bookmarks toolbar (personal bar) and status bar. E.g.: in Firefox 3, Tools/Options... creates a chrome window.

Supported in:

modal

Note: This feature requires the UniversalBrowserWrite privilege (bug 180048).

If set to yes, the new window is said to be modal. The modal feature makes the new, secondary window stay on top/in front of its opener. Modal windows do not appear on the Windows task bar and can not be minimized on the Windows task bar. Another unrelated browser window may still be placed above the modal window.

The exact behavior of modal windows depends on the platform and on the Mozilla release version.

The modal window's opener can not be on top of the modal window but it can be focused and it can still operates (e.g.: one can click a link in the opener and the opener window will load the referenced resource). The modal window can be minimized inside the opener viewport but not on the windows task bar.

The MSIE 7 almost equivalent to the modal feature can be obtained by the recourse of the method showModalDialog( ) (bug 194404).

Supported in: Firefox 2+

titlebar

By default, all new secondary windows have a titlebar. If set to no and if privileged security access is granted by the user, then this feature removes the titlebar from new secondary windows.
Firefox users can force new windows to always render the titlebar by setting
dom.disable_window_open_feature.titlebar
to true in about:config or in their user.js file.

Supported in: Firefox 2+

alwaysRaised

If set to yes, the new window floats on top of, in front of any other browser windows, whether it is active or not. This feature requires enhanced privileged security access granted from the user.

At the time of writing this file, alwaysRaised feature is not supported when used in content script due to bug 274088; it works from chrome scripts though.

alwaysLowered

If set to yes, the new created floats below, under its own parent when the parent window is not minimized. alwaysLowered windows are often referred as pop-under windows. The alwaysLowered window can not be on top of the parent but the parent window can be minimized.

At the time of writing this file, alwaysLowered feature is not supported when used in content script due to bug 274088.

z-lock

Same as alwaysLowered. This feature requires privileged security access granted by the user. Its behavior is the same as alwaysLowered. Often referred as pop-under windows. A z-locked window can not be on top of its parent.

close

When set to no, this feature removes the system close command icon and system close menu item. Setting close=no requires both enhanced privileged abilities and dialog=yes feature in Firefox 1.x. close=no will override minimizable=yes.

Supported in: Firefox 2+

The position and size feature elements require a number to be set. The toolbars and window functionalities can be set with a yes or no; you can use 1 instead of yes and 0 instead of no. The toolbar and functionality feature elements also accept the shorthand form: you can turn a feature on by simply listing the feature name in the strWindowFeatures string. If you supply the strWindowFeatures parameter, then the titlebar, close and hotkeys are still yes by default, but the other features which have a yes|no choice will be no by default and will be turn off.

<script type="text/javascript">
var WindowObjectReference; // global variable
function openRequestedPopup()
{
WindowObjectReference = window.open("http://www.domainname.ext/path/ImageFilename.png",
"DescriptiveWindowName",
"width=420,height=230,resizable,scrollbars=yes,status=1");
}
</script>
    

In this example, the window will be resizable, it will render scrollbar(s) if needed, if the content overflows requested window dimensions and it will render the status bar. It will not render the menubar nor the location bar. Since the author knew about the size of the image (400 pixels wide and 200 pixels high), he added the margins applied to the root element in MSIE 6 which is 15 pixels for top margin, 15 pixels for the bottom margin, 10 pixels for the left margin and 10 pixels for the right margin.

[Page Content]

Best recommendable practices

<script type="text/javascript">
var WindowObjectReference; // global variable
function openFFPromotionPopup()
{
if(WindowObjectReference == null || WindowObjectReference.closed)
/* explanation: if the pointer to the window object
in memory does not exist or
if such pointer exists but the window was closed */
  {
  WindowObjectReference = window.open("http://www.spreadfirefox.com/",
  "PromoteFirefoxWindowName", "resizable=yes,scrollbars=yes,status=yes");
  }
/* explanation: then create it. The new window will be created and
will be brought on top of any other window. */
else
  {
  if(WindowObjectReference.focus)
    {
    WindowObjectReference.focus();
    };
  };

/* explanation: else the window reference must exist and the window
is not closed; therefore, we can bring it back on top of any other
window (and giving it system focus) with the focus() function. There
would be no need to re-create the window or to reload the referenced
resource.

But first, we need to test, to verify the support of the focus()
function before calling it.*/
}
</script>

(...)

<p><a href="http://www.spreadfirefox.com/" target="PromoteFirefoxWindowName"
onclick="openFFPromotionPopup(); return false;">Promote
Firefox adoption</a></p>
      

The above code solves a few usability problems related to links opening secondary window. The purpose of the return false in the code is to cancel default action of the link: if the onclick event handler is executed, then there is no need to execute the default action of the link. But if javascript support is disabled or non-existent on the user's browser, then the onclick event handler is ignored and the browser loads the referenced resource in the target frame or window that has the name "PromoteFirefoxWindowName". If no frame nor window has the name "PromoteFirefoxWindowName", then the browser will create a new window and will name it "PromoteFirefoxWindowName".
More reading on the use of the target attribute:
HTML 4.01 Target attribute specification
How to create a link that opens a new window?

You can also parameterize the function to make it versatile, functional in more situations, therefore re-usable in scripts and webpages:

<script type="text/javascript">
var WindowObjectReference; // global variable
function openRequestedPopup(strUrl, strWindowName)
{
if(WindowObjectReference == null || WindowObjectReference.closed)
  {
  WindowObjectReference = window.open(strUrl, strWindowName,
  "resizable=yes,scrollbars=yes,status=yes");
  }
else
  {
  if(WindowObjectReference.focus)
    {
    WindowObjectReference.focus();
    };
  };
}
</script>

(...)

<p><a href="http://www.spreadfirefox.com/" target="PromoteFirefoxWindow"

onclick="openRequestedPopup(this.href, this.target); return false;">Promote
Firefox adoption</a></p>
      

You can also make such function able to open only 1 secondary window and to reuse such single secondary window for other links in this manner:

<script type="text/javascript">
var WindowObjectReference; // global variable
var PreviousUrl; /* global variable which will store
the url currently in the secondary window */
function openRequestedSinglePopup(strUrl)
{
if(WindowObjectReference == null || WindowObjectReference.closed)
  {
  WindowObjectReference = window.open(strUrl, "SingleSecondaryWindowName",
  "resizable=yes,scrollbars=yes,status=yes");
  }
else if(previousUrl != strUrl)
  {
  WindowObjectReference = window.open(strUrl, "SingleSecondaryWindowName",
  "resizable=yes,scrollbars=yes,status=yes");
  if(WindowObjectReference.focus)
    {
    WindowObjectReference.focus();
    };
  /* explanation: if the resource to load is different,
  then we load it in the already opened secondary window and then
  we bring such window back on top/in front of its parent window.

  We verify first the support of the focus() function before
  calling it. */
  }
else
  {
  if(WindowObjectReference.focus)
    {
    WindowObjectReference.focus();
    };
  };
PreviousUrl = strUrl;
/* explanation: we store the current url in order to compare url
in the event of another call of this function. */
}
</script>

(...)

<p><a href="http://www.spreadfirefox.com/" target="SingleSecondaryWindowName"
onclick="openRequestedSinglePopup(this.href); return false;">Promote
Firefox adoption</a></p>

<p><a href="http://www.mozilla.org/support/firefox/faq"
target="SingleSecondaryWindowName"
onclick="openRequestedSinglePopup(this.href); return false;">Firefox FAQ</a></p>
      

[Page Content]

FAQ

  1. How to prevent the message box asking the user if he wants to close the window?

    You can not. New windows not opened by javascript can not as a rule be closed by javascript. The javascript console in Mozilla-based browsers will report the warning message:
    "Scripts may not close windows that were not opened by script."
    Otherwise the history of URLs visited during the browser session would be lost.
    More on the window.close() method

  2. How to bring back the window if minimized or if the window is behind another window?

    First check for the existence of the window object reference of such window and if it exists and if it has not been closed, then use focus() method. There is no other reliable and efficient way. You can examine an example explaining how to use the focus() method.

  3. How do I force a maximized window?

    You can not. All browser manufacturers try to make the opening of new secondary windows noticed by users and noticeable by users to avoid confusion, to avoid disorienting users.

  4. How do I turn off window resizability or remove toolbars?

    You can not by force. Mozilla-based users can have absolute control over window functionalities (resizability and scrollability) and toolbars presence by editing user preferences in about:config or via advanced prefs. Since your users are the ones who are targeted to view and to use such windows (not you, the web author), then best is to avoid interfering with their habits and preferences. We recommend to always set the resizability and scrollbars presence (if needed) to yes to insure accessibility to content and usability of windows. This is in the best interests of the web author and of the users.

    Starting with Firefox 3, all windows are resizable and have the location bar.

  5. How to resize a window to fit its content?

    You can not reliably because the users can prevent the window from being resized by unchecking the
    Edit/Preferences/Advanced/Scripts & Plug-ins/Allow Scripts to/
    Move or resize existing windows
    checkbox in Mozilla or
    Tools/Options/Web Features/Enable Javascript/Advanced button/
    Move or resize existing windows
    checkbox in Firefox or by setting
    dom.disable_window_move_resize
    to true in the about:config or by editing accordingly their user.js file. In general, users usually disable moving and resizing of existing windows because allowing authors' scripts to do so has been abused overwhelmingly in the past and the rare scripts that do not abuse such feature are often wrong, inaccurate when resizing the window. 99% of all those scripts disable window resizability and disable scrollbars when in fact they should enable both of these features to allow a cautious and sane fallback mechanism if their calculations are wrong. The window method sizeToContent() is also disabled if the user uncheck the preference Move or resize existing windows checkbox. Moving and resizing a window remotedly on the user's screen via script will very often annoy the users, will disorient the user and will be wrong at best. The web author expects he can have full control of (and can decide about) every position and size aspects of the users' browser window ... which is simply not true.

  6. How do I open a referenced resource of a link into a new tab? or in a specific tab?

    Currently, you can not. Only the user can set his advanced preferences to do that. K-meleon 1.5, a Mozilla-based browser, gives complete control and power to the user regarding how links are opened. Some advanced extensions also give Mozilla and Firefox a lot of power over how referenced resources are loaded.
    In a few years from now, the target property of the CSS3 hyperlink module may be implemented (if CSS3 Hyperlink module as it is right now is approved). And even if and when such possibility happens, you can expect browser manufacturers and Mozilla browsers (and other browsers based on/offering tab-browsing) to give the user entire veto power and full control over how links can open web pages. How to open a link should always be entirely under the control and the power of the user.

  7. How do I know if a window has opened, is still opened?

    You can test for the existence of the window object reference which is the returned value in case of success of the window.open() call and then verify that WindowObjectReference.closed return value is false but this is not a reliable way to detect presence of an active popup blocking software.
    Microsoft answers pretty much the same: How can I tell if Internet Explorer has blocked my pop-up window? Functions that return a window object will return null if the window is blocked. Always check the return value of window.open() before using it to avoid script errors when pop-ups are blocked. quote from Finetune Your Web Site for XP SP2

  8. What is the javascript relationship between the main window and the secondary window?

    The return value of the window.open() method and the opener keyword. The WindowObjectReference links the main (opener) window to the secondary (sub-window) window while the opener keyword will link the secondary window to its main (opener) window.

  9. I can not access the properties of the new secondary window. I always get an error in the javascript console saying "Error: uncaught exception: Permission denied to get property <property_name or method_name>". Why is that?

    It is because of the cross-domain script security restriction (also referred as the "Same Origin Policy"). A script loaded in a window (or frame) from a distinct origin (domain name) cannot get nor set properties of another window (or frame) or the properties of any of its HTML objects coming from another distinct origin (domain name). Therefore, before executing a script targeting a secondary window, the browser in the main window will verify that the secondary window has the same domain name.
    More reading on the cross-domain script security restriction:
    https://developer.mozilla.org/En/Same_origin_policy_for_JavaScript

[Page Content]

Usability issues

Generally speaking, it is preferable to avoid resorting to window.open() for several reasons:

If you want to offer to open a link in a new window, then follow tested and recommendable usability and accessibility guidelines:

Glossary

Opener window, parent window, main window, first window
terms often used to describe or to identify the same window. It is the window from which a new window will be created. It is the window on which the user clicked a link which lead to the creation of another, new window.
Sub-window, child window, secondary window, second window
terms often used to describe or to identify the same window. It is the new window which was created.
Unrequested popup windows
script-initiated windows opening automatically without the user's consent.

Specification

DOM Level 0. window.open() is not part of any W3C specification or technical recommendation.

[Page Content]

Notes

Note on precedence

In cases where left and screenX (and/or top and screenY) have conflicting values, then left and top have precedence over screenX and screenY respectively. If left and screenX (and/or top and screenY) are defined in the strWindowFeatures list, then left (and/or top) will be honored and rendered. E.g.:

WindowObjectReference = window.open("http://news.bbc.co.uk/", "BBCWorldNewsWindowName",
"left=100,screenX=200,resizable,scrollbars,status");
Result: here, the new window will be positioned at 100 pixels from the
left side of the work area for applications of the user's operating
system, not at 200 pixels.
      

If left is set but top has no value and screenY has a value, then left and screenY will be the coordinate positioning values of the secondary window.

outerWidth has precedence over width and width has precedence over innerWidth.
outerHeight has precedence over height and height has precedence over innerHeight.

WindowObjectReference = window.open("http://www.wwf.org/",
"WWildlifeOrgWindowName",
"outerWidth=600,width=500,innerWidth=400,resizable,scrollbars,status");

Result: here, Mozilla-browsers will create a new window with an outerWidth
of 600 pixels wide and will ignore the request of a width of 500 pixels
and will also ignore the request of an innerWidth of 400 pixels.
      

Note on position and dimension error correction

Requested position and requested dimension values in the strWindowFeatures list will not be honored and will be corrected if any of such requested value does not allow the entire browser window to be rendered within the work area for applications of the user's operating system. No part of the new window can be initially positioned offscreen. This is by default in all Mozilla-based browser releases.
MSIE 6 has a similar error correction mechanism but it is not activated by default in all security levels: a security setting can disable such error correction mechanism.

Note on scrollbars

When content overflows window viewport dimensions, then scrollbar(s) (or some scrolling mechanism) are necessary to insure that content can be accessed by users. Content can overflow window dimensions for several reasons which are outside the control of web authors:

Note on status bar

You should assume that a large majority of users' browsers will have the status bar or that a large majority of users will want to force the status bar presence: best is to always set this feature to yes. Also, if you specifically request to remove the status bar, then Firefox users will not be able to view the Site Navigation toolbar if it is installed. In Mozilla and in Firefox, all windows with a status bar have a window resizing grippy at its right-most side. The status bar also provides info on http connection, hypertext resource location, download progress bar, encryption/secure connection info with SSL connection (displaying a yellow padlock icon), internet zone icons, privacy policy/cookie icon, etc. Removing the status bar usually removes a lot of functionalities, features and info which are considered useful and sometimes vital by the users and for the users.

Note on security issues of the status bar presence

in MSIE 6 for XP SP2:

"For windows opened using window.open():
Expect the status bar to be present, and code for it. The status bar will be on by default and is 20-25 pixels in height. (...)"
quote from Fine-Tune Your Web Site for Windows XP Service Pack 2, Browser Window Restrictions in XP SP2

"(...) windows that are created using the window.open() method can be called by scripts and used to spoof a user interface or desktop or to hide malicious information or activity by sizing the window so that the status bar is not visible.
Internet Explorer windows provide visible security information to the user to help them ascertain the source of the Web page and the security of the communication with that page. When these elements are not in view, the user might think they are on a more trusted page or interacting with a system process when they are actually interacting with a malicious host. (...)
Script-initiated windows will be displayed fully, with the Internet Explorer title bar and status bar. (...)
Script management of Internet Explorer status bar
Detailed description
Internet Explorer has been modified to not turn off the status bar for any windows. The status bar is always visible for all Internet Explorer windows. (...) Without this change, windows that are created using the window.open() method can be called by scripts and spoof a user interface or desktop or hide malicious information or activity by hiding important elements of the user interface from the user.
The status bar is a security feature of Internet Explorer windows that provides Internet Explorer security zone information to the user. This zone cannot be spoofed (...)"
quote from Changes to Functionality in Microsoft Windows XP Service Pack 2, Internet Explorer Window Restrictions

Note on fullscreen

In MSIE 6 for XP SP2:

"window.open() with fullscreen=yes will now result in a maximized window, not a kiosk mode window."
quote from From Fine-Tune Your Web Site for Windows XP Service Pack 2.

"the definition of the fullscreen=yes specification is changed to mean 'show the window as maximized,' which will keep the title bar, address bar, and status bar visible. (...)"
quote from Changes to Functionality in Microsoft Windows XP Service Pack 2, Script sizing of Internet Explorer windows

[Page Content]

Note on outerHeight and height

Tutorials

Javascript windows (tutorial) by Lasse Reichstein Nielsen

The perfect pop-up (tutorial) by accessify.com

Popup windows and Firefox: interactive demos by Gérard Talbot

References

Links Want To Be Links by Jukka K. Korpela

Links & JavaScript Living Together in Harmony by Jeff Howden

window.open() reference at developer.mozilla.org

[Page Content]

Valid HTML 4.01!   CSS compliant