JavaScript Window open()
JavaScript Window open()
The open() method is used to open a new browser window or new tab. It depends on browser settings and the parameter values. Its opposite method is close() which is used to close browser windows and tabs.
Syntax:-
Its syntax is:- window.open(URL, name, specs, replace)
Return:-
Its return is:- reference to the new window or null if failed
Further Explanation:-
Parameter | Description |
URL | Optional. The URL of the page to open. If not specified then a blank window/tab will be open. |
name | Optional.The name of the window or the target attribute. If not specified, then _blank value will be used for the target attribute |
specs | Optional. A comma-separated list of items with no whitespace. It includes fullscreen, height, left, menubar, resizable, scrollbars, top, width, etc, and many more. |
replace |
Specifies whether the URL creates a new entry or replaces the current entry in the history list. |