Jasinski Technical Wiki

Navigation

Home Page
Index
All Pages

Quick Search
»
Advanced Search »

Contributor Links

Create a new Page
Administration
File Management
Login/Logout
Your Profile

Other Wiki Sections

Software

PoweredBy

Page History: Window Object's Open Method - JavaScript

Compare Page Revisions



« Older Revision - Back to Page History - Current Revision


Page Revision: Thu, Aug 06, 2009, 11:00 AM


General Syntax

window.open(url, name, features, replace);

Parameters

Name

The name parameter is an optional name for the window, or it can be one of the following tokens.

TokenDefinition
_blankThe url is loaded into a new, unnamed window.
_mediaThe url is loaded in the Media Bar in Microsoft Internet Explorer 6. Microsoft Windows XP Service Pack 2 (SP2) and later. This feature is no longer supported. By default the url is loaded into a new browser window or tab.
_parentThe url is loaded into the current frame's parent. If the frame has no parent, this value acts as the value _self.
_searchDisabled in Windows Internet Explorer 7, see Security and Compatibility in Internet Explorer 7 for details. Otherwise, the url is opened in the browser's search pane in Internet Explorer 5 or later.
_selfThe current document is replaced with the specified url.
_topurl replaces any framesets that may be loaded. If there are no framesets defined, this value acts as the value _self.

Features

The features parameter uses the following string tokens. Tokens marked as flags can be yes or no; also 1 and 0 can be used in place of yes and no, respectively.

TokenDefinition
channelmode = flagSpecifies whether to display the window in theater mode. The default is no. Internet Explorer 7. channelmode = yes overrides height, width, top, and left values. When active, the Navigation Bar is hidden and the Title Bar is visible. The Channel Band is no longer supported in Internet Explorer 7. Prior to Internet Explorer 7 channelmode = yes displays the Channel Band in theatre mode.
directories = flagSpecifies whether to add directory buttons. The default is yes. Internet Explorer 7. This feature is no longer supported.
fullscreen = flagSpecifies whether to display the browser in full-screen mode. The default is no. Use full-screen mode carefully. Because this mode hides the browser's title bar and menus, you should always provide a button or other visual clue to help the user close the window. ALT+F4 closes the new window. Internet Explorer 7. A window in full-screen mode does not need to be in theatre mode. Prior to Internet Explorer 7 a window in full-screen mode must also be in theater mode (channelmode).
height = numberInternet Explorer 7. Sets the height of the window in pixels. The minimum value is 150, and specifies the minimum height of the browser content area. Prior to Internet Explorer 7 the minimum height value is 100.
left = numberSpecifies the left position, in pixels. This value is relative to the upper-left corner of the screen. The value must be greater than or equal to 0.
location = flagInternet Explorer 7. Specifies whether to display the navigation bar. The default is yes. Prior to Internet Explorer 7 this feature specifies whether to display the address bar. The Back, Forward, and Stop commands are now located in the Navigation bar. Prior to Internet Explorer 7 navigation commands were located in the toolbar.
menubar = flagSpecifies whether to display the menu bar. The default is yes. Internet Explorer 7. By default the menu bar is hidden unless revealed by the ALT key. menubar = no prohibits the menubar from appearing even when the Alt key is pressed. The combination of menubar = no and toolbar = no hides the toolbar and disables any additional third-party user interfaces.
resizable = flagSpecifies whether to display resize handles at the corners of the window. The default is yes. Internet Explorer 7. resizable = no disables tabs in a new window.
scrollbars = flagSpecifies whether to display horizontal and vertical scroll bars. The default is yes.
status = flagSpecifies whether to add a Status Bar at the bottom of the window. The default is yes.
titlebar = flagSpecifies whether to display a Title Bar for the window. The default is yes. Internet Explorer 5.5 and later. This feature is no longer supported. The Title Bar remains visible unless the fullscreen sFeature is active. This parameter is ignored prior to Internet Explorer 5.5. It applies only if the calling application is an HTML Application or a trusted dialog box.
toolbar = flagInternet Explorer 7. Specifies whether to display the browser command bar, making buttons such as Favorites Center, Add to Favorites, and Tools available. The default is yes. The combination of menubar = no and toolbar = no turn off the Toolbar and any additional third-party user interfaces. Prior to Internet Explorer 7 the toolbar sFeature specifies whether to display the browser toolbar, making buttons such as Back, Forward, and Stop available.
top = numberSpecifies the top position, in pixels. This value is relative to the upper-left corner of the screen. The value must be greater than or equal to 0.
width = numberInternet Explorer 7. Sets the width of the window in pixels. The minimum value is 250, and specifies the minimum width of the browsers content area. Prior to Internet Explorer 7 the minimum height value is 100.

Replace

The replace parameter is an optional Boolean that specifies whether the url creates a new entry or replaces the current entry in the window's history list. This parameter only takes effect if the url is loaded into the same window.

ValueDefinition
trueurl replaces the current document in the history list.
falseurl creates a new entry in the history list.

Example

The code below opens a window with toolbar and status bar.

window.open ("http://www.google.com", "mywindow","status=1,toolbar=1");

ScrewTurn Wiki version 3.0.1.400. Some of the icons created by FamFamFam. Except where noted, all contents Copyright © 1999-2024, Patrick Jasinski.