Vaadin open link in new tab

java, vaadin

Solution

getUI().getPage().open("http://www.google.com", "_blank");

The `_blank` window name is important here. Beware that you may also have browsers that will might open the resource in a new window instead.

There is also another signature to the `open()` method, i.e.

open(String url, String windowName, boolean tryToOpenAsPopup) 

that may fit the bill. HTH.

References: Page (Vaadin 7.2.1 API).

Problem

I have the following piece of code that I wrote using Vaadin. The code opens the page `www.google.com` when the user clicks the button. My question is is there any way for me to specify that the page is to be opened in a new tab? Thanks. ``` button.addClickListener(new Button.ClickListener() { public void buttonClick(ClickEvent event) { getUI().getPage().setLocation("http://www.google.com"); } }); ```

Original source

Related problems