Tags
Asked 2 years ago
9 Jun 2021
Views 230
Allene

Allene posted

how to use window.open() ?

how to use window.open() ?
Is window.open() still useful nowadays?

window.open("https://www.google.com");

is that any other way format to use it , i want to learn more about the window.open
css-learner

css-learner
answered Jun 9 '21 00:00

Following is the syntax of the window.open


window.open(URL, "name of window",Options);

window.open can be following parameters
first parameter is Url , like www.jquery.com
second parameter is name of the window , or it can be
_blank - open into a new window, or tab. This is default
_parent - open into the parent frame
_self - open in the current page
_top - replaces any framesets that may be loaded
third parameter is options , it can be used for positioning or sizing of the window or tab
fullscreen =yes|no|1|0 display the browser in full-screen mode or not
height =pixels height of the window.
left =pixels left position of the window.
location =yes|no|1|0 display the address field or not.
menubar =yes|no|1|0 display the menu bar or not
resizable =yes|no|1|0 window is resizable or not
scrollbars =yes|no|1|0 display scroll bars at window or not
status =yes|no|1|0 show status bar or not
titlebar =yes|no|1|0 show the title bar or not
toolbar =yes|no|1|0 display the browser toolbar or not
top =pixels Top position of the window.
width =pixels width of the window

Please read above before to use it , you will get how to use of window.open


window.open("http://www.google.com","_blank","widht=300,height=200")

above exampled code will open google website in new blank window which have width 300 and height have 200

Post Answer