Easy Tutorial
❮ Prop Style Cssfloat Jsref Getutchours ❯

Window open() Method


Definition and Usage

The open() method is used to open a new browser window or to find a named window.

Syntax

Parameter Description
URL Optional. The URL of the page to open. If no URL is specified, a new blank window is opened.
name Optional. Specifies the target attribute or the name of the window. Supported values are: _blank - URL loads in a new window (default)<br> _parent - URL loads into the parent frame<br> _self - URL replaces the current page<br> _top - URL replaces any可加载的框架集<br> name - The name of the window
specs Optional. A comma-separated list of items. Supported values are: <br> <br> channelmode=yes no 1 0<br> Whether to display the window in theater mode. Default is no. IE only<br> <br> directories=yes no 1 0<br> Whether to add directory buttons. Default is yes. IE only<br> <br> fullscreen=yes no 1 0<br> Whether the browser should display in full-screen mode. Default is no. The window must also be in theater mode in full-screen mode. IE only<br> <br> height=pixels<br> The height of the window. Minimum value is 100<br> <br> left=pixels<br> The left position of the window<br> <br> location=yes no 1 0<br> Whether to display the address field. Default is yes<br> <br> menubar=yes no 1 0<br> Whether to display the menu bar. Default is yes<br> <br> resizable=yes no 1 0<br> Whether the window is resizable. Default is yes<br> <br> scrollbars=yes no 1 0<br> Whether to display scroll bars. Default is yes<br> <br> status=yes no 1 0<br> Whether to add a status bar. Default is yes<br> <br> titlebar=yes no 1 0<br> Whether to display the title bar. Ignored unless calling an HTML application or a trusted dialog. Default is yes<br> <br> toolbar=yes no 1 0<br> Whether to display the browser toolbar. Default is yes<br> <br> top=pixels<br> The top position of the window. IE only<br> <br> width=pixels<br> The width of the window. Minimum value is 100
replace Optional. Specifies whether the URL creates a new entry or replaces the current entry in the window's history. Supported values are: true - URL replaces the current entry in the history.<br> false - URL creates a new entry in the history.

Browser Support

All major browsers support the open() method.


Examples

Example 1

Open www.tutorialpro.org in a new browser window:

function open_win() {
    window.open("https://www.tutorialpro.org");
}

Example 2

Open a new browser window with a blank page:

function openWin(){
    myWindow=window.open('','','width=200,height=100');
    myWindow.document.write("<p>This is 'my window'</p>");
    myWindow.focus();
}

More Examples

Open a new window and control its appearance

Open multiple windows with one click

Open a page in a new window/tab

❮ Prop Style Cssfloat Jsref Getutchours ❯