Categories
JavaScript Answers

How to open window and specific size on click with JavaScript?

Spread the love

Sometimes, we want to open window and specific size on click with JavaScript.

in this article, we’ll look at how to open window and specific size on click with JavaScript.

How to open window and specific size on click with JavaScript?

To open window and specific size on click with JavaScript, we call window.open with a string that specifies the window size.

For instance, we write

window.open("http://example.com", "mywin", "width=500,height=500");

to call window.open to open http://example.com in a window that’s 500px wide by 500px high as specified with

"width=500,height=500"

Conclusion

To open window and specific size on click with JavaScript, we call window.open with a string that specifies the window size.

By John Au-Yeung

Web developer specializing in React, Vue, and front end development.

Leave a Reply

Your email address will not be published. Required fields are marked *