Reputation: 25892
I may open a browser new tab with Anchor component configured with target=_blank
. How to do the same in Vaadin23 with the Button
component inside the ClickListener
code?
Upvotes: 1
Views: 1877
Reputation: 1219
You can do it using UI.getCurrent().getPage().open(String url)
, which opens the URL in a new tab by default.
Button button = new Button("Click Me", e -> {
UI.getCurrent().getPage().open("https://stackoverflow.com");
});
add(button);
Upvotes: 3