Documentation versions (currently viewingVaadin 14)

You are viewing documentation for an older Vaadin version. View latest documentation

Browser Window Resize Events

The Page class allows you to register a listener for events that affect the web page and the browser window in which the Vaadin UI resides. The Page instance corresponding to a given UI is accessed by the getPage() method of the UI.

Example: Accessing the browser window size and adding a size-change listener.

Page page = UI.getCurrent().getPage();
        event ->"Window width="
                + event.getWidth()
                + ", height=" + event.getHeight()));