How to change window size

Can I change Window size when user change browser window size?
Thank you.

You could use Page.addBrowserWindowResizeListener() to fire an event when the browser is resized and resize the window there.


Alternatively, you could use percentage width / height in your Window; that should work too.


You could also use CSS media queries to further improve responsiveness, if using the same percentage values doesn’t work for wide and small screens. Browser window relative units (vh, wv) are also very useful for e.g. centering or otherwise positioning the Window trhough plain CSS.
For example, for a Window with a custom style name ‘myWindowStyle’:

@media (min-width: 550px) and (max-width: 1054px) {
    .myWindowStyle {
           margin-top: 25vh;
           margin-left: 25vw;
           width : 50%;
           height : 50%;
@media (max-width: 549px) {
    .myWindowStyle {
            margin-top: 5vh;
           margin-left: 5vw;
            width : 90%;
            height : 90%;

BR, Katri