Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to open my page to with a specific size browser window?

This is a one page scrolling site for kids. The content is best viewed at 1200 pixels wide. Is there a way I can make the window default to that size when the site is visited?

like image 597
Harry Robinsob Avatar asked Oct 20 '25 15:10

Harry Robinsob


1 Answers

No, but you can have a landing page with a button on it that opens your desired page using window.open, and you can tell window.open how big you want the window it opens to be.

Details here, but basically (inside a click handler or similar):

window.open("http://example.com", "width=1200");

This is a suggestion to the browser, which it can ignore if it likes, but a value in that range is likely to be fine. (Whereas browsers tend to disallow very small windows.) You can also specify height, whether it has various window features, etc.

Of course, if you can make the page work well in any width, that would be better. Some of us are positively irritated by sites that try to tell us how wide our browser windows should be. :-)

like image 100
T.J. Crowder Avatar answered Oct 23 '25 05:10

T.J. Crowder



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!