javascriptno-framework

window.open specify content size not window size?


When you do a window.open() you can specify the size of the new window. well depending on a lot of things (like browser, toolbars, etc.) the viewport can vary in size.

For example if I have an image that is 500x400 in size, and I want to open a new window to show exactly that image with no access white space, and no need for scrolling. the window size will vary to make this always true.

So is there a way to specify the viewport size of a new window, instead of the window size?

Thanks!


Solution

  • You'll need to calculate the viewport size and tweak your window size accordingly.