javascript - How to create popup new window browser with small size -


i tried create link, if clicked popout new windows browser small size, tried code

<p>click button open new browser window.</p>  <button onclick="myfunction()">try it</button>  <script> function myfunction() {     window.open("http://www.w3schools.com"); } </script> 

the result success move other link opened in new tab on parent browser, tried create link opened in new window browser small size.

you can set height , width.

window.open("http://www.w3schools.com", "", "width=200,height=100"); 

to set position center.

var dualscreenleft = window.screenleft != undefined ? window.screenleft : screen.left; var dualscreentop = window.screentop != undefined ? window.screentop : screen.top;  var width = window.innerwidth ? window.innerwidth : document.documentelement.clientwidth ? document.documentelement.clientwidth : screen.width; var height = window.innerheight ? window.innerheight : document.documentelement.clientheight ? document.documentelement.clientheight : screen.height;  var left = ((width / 2) - (w / 2)) + dualscreenleft; var top = ((height / 2) - (h / 2)) + dualscreentop;  window.open("http://www.w3schools.com", "", "width=200,height=100, top=' + top + ', left=' + left"); 

Popular posts from this blog

php - How should I create my API for mobile applications (Needs Authentication) -

5 Reasons to Blog Anonymously (and 5 Reasons Not To)

Google AdWords and AdSense - A Dynamic Small Business Marketing Duo