This method is used to open a new browser window.
This method is used
to open a new browser window. Note that, when using this method with event
handlers, you must use the syntax window.open() as opposed to just
open(). Calling just open() will, because of the scoping
of static objects in JavaScript, create a new document (equivalent to
document.open()), not a window.
Note that many of the values for the features parameter don't work in all browsers.
The may also
represent potential sources of security problems
and therefore require signed script (and user's permission) if they are to be used.
Details of the available values are given below:
features Value | Description |
---|---|
alwaysLowered | When set to yes, this creates a window that always floats below other windows. |
alwaysRaised | When set to yes, this creates a window that always floats above other windows. |
channelmode | sets if the window appears in channel mode. |
dependent | When set to yes, the new window is created as a child (closes when the parent window closes and does not appear on the task bar on Windows platforms) of the current window. |
directories | When set to yes, the new browser window has the standard directory buttons. |
fullscreen | the new window will appear in full screen. |
height | This sets the height of the new window in pixels. |
hotkeys | When set to no, this disables the use of hotkeys (except security and quit hotkeys) in a window without a menubar. |
innerHeight | This sets the inner height of the window in pixels. |
innerWidth | This sets the inner width of the window in pixels. |
left | same as screenX, allows a new window to be created at a specified number of pixels from the left side of the screen. |
location | When set to yes, this creates the standard Location entry feild in the new browser window. |
menubar | When set to yes, this creates a new browser window with the standard menu bar (File, Edit, View, etc.). |
outerHeight | This sets the outer height of the new window in pixels. |
outerWidth | This sets the outer width of the new window in pixels. |
resizable | When set to yes this allows the resizing of the new window by the user. |
screenX | This allows a new window to be created at a specified number of pixels from the left side of the screen. |
screenY | This allows a new window to be created at a specified number of pixels from the top of the screen. |
scrollbars | When set to yes the new window is created with the standard horizontal and vertical scrollbars, where needed |
status | When set to yes, the new window will have the standard browser status bar at the bottom. |
titlebar | When set to yes the new browser window will have the standard title bar. |
toolbar | When set to yes the new window will have the standard browser tool bar (Back, Forward, etc.). |
top | same as screenY, allows a new window to be created at a specified number of pixels from the top of the screen. |
width | This sets the width of the new window in pixels. |
z-lock | When set to yes this prevents the new window from rising above other windows when it is made active (given focus). |
myWindow = window.open("", "tinyWindow", 'toolbar,width=150,height=100')
myWindow.document.write("Welcome to this new window!")
myWindow.document.bgColor="lightblue"
myWindow.document.close()
Opens a new light blue window and prints some text in it.