/

HTML / CSS / JavaScript Tutorial

JavaScript Window method: open()

[this page | pdf | back links]

The open() method (when applied to Window objects in the JavaScript BOM) opens a new browser window.

 

It has the following syntax with the following parameters. It does not return a value.

 

window.open(URL, name, specifications, replace)

 

Parameter

Required / Optional

Description

URL

Optional

URL of page to open. If no URL is specified then a new window with about:blank is opened

name

Optional

The HTML target attribute (name) applicable to the window (e.g. _blank, …)

specifications

Optional

A comma-separated list of items, no whitespaces, see below

replace

Optional

Boolean specifying whether URL replaces the current entry in the history list (true) or creates a new entry (false)

 

Values supported by the specifications parameter vary by browser but for some browsers include following:

 

Sub-Parameter

Options

Description

channelmode

yes|no|1|0

Whether to display window in ‘theatre’ mode (default no)

directories

yes|no|1|0

Obsolete. Whether to add directory buttons (default yes)

fullscreen

yes|no|1|0

Whether to display in full-screen mode (defatul no)

height

pixels

Height of window (min 100)

left

pixels

Left position of window (min 0)

location

yes|no|1|0

Whether to display address field

menubar

yes|no|1|0

Whether to display menubar

resizable

yes|no|1|0

Whether window is resizable

scrollbars

yes|no|1|0

Whether to display scrollbars

titlebar

yes|no|1|0

Whether to display titlebar. Ignored unless calling application is HTML Application or trusted dialog box

toolbar

yes|no|1|0

Whether to display browser toolbar

top

pixels

top position of window (min 0)

width

pixels

Width of window (min 100)

 


NAVIGATION LINKS
Contents | Prev | Next | JavaScript DOM (and BOM)


Desktop view | Switch to Mobile