Search code examples
vaadinvaadin-flowvaadin23

Vaadin 23 change browser url based on button click in the application


Based on the button click in Vaadin application, I'd like to change the browser URL value. I'd like to add some GET parameters to the URL. Please advise how to implement this with Vaadin 23.


Solution

  • I use the following code to update the browser url:

    String baseUrl = RouteConfiguration.forSessionScope().getUrl(getClass());
    String urlWithParameters = baseUrl + //add parameters here
    getUI().get().getPage().getHistory().replaceState(null, urlWithParameters);