Vaadin open link in new tab

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).


Try the following code:

BrowserWindowOpener opener = new BrowserWindowOpener(new ExternalResource(url));
opener.setFeatures("");
opener.extend(button);

Using Button, BrowserWindowOpener and getUI().getPage().open("http://www.google.com", "_blank"); is discouraged since that is usually blocked by popup blockers.

Instead go with the Link component:

final Link link = new Link("Google", new ExternalResource("http://www.google.com"));
link.setTargetName("_blank");

See more in the Vaadin Link Documentation

Tags:

Java

Vaadin