How to open a window as Tab from a sub window ?

I mean, I want to create a button on a sub window and if I click it, it can open a new external window. How Can I do?

I tried

“getMainWindow().executeJavaScript(“‘’, ‘_blank’)”);” It shows sub-window cannot execute JavaScript
“getMainWindow().open(new ExternalResource(LinkButton.this.url), “_blank”);”
also not work.

What should I do?

Thank you very much!

Hi Xiao,

Are you try to open getting the application instance?, i.e. doing something like:

getApplication().getMainWindow().open(new ExternalResource(LinkButton.this.url), "_blank");

Hope this helps.


Thank you Javier,
It does not work. In this way I can open a new window but it is a blank window. I do give it the URL…

In FF, it just open a blank page; in IE, it shows
http://localhost:8080/xxxx/VAADIN/widgetsets/ and cannot open the page

Hi Xiao,

I think I don’t understand your initial question. If you’re trying to open a new window using a Link component, the way to do this should be doing something like this:

    // Link creation
    Link link = new Link("Google", new ExternalResource(""));
    // Add link to your layout

Hope this helps.