Hi all,
How do i open a URL in a new browser window in Vaadin 7? It seems there is no more Window.open() method.
PS: I don´t want to use a Link. I want, for example, to open a new browser window when the user click some button.
Regards,
Fabiano
Hi all,
How do i open a URL in a new browser window in Vaadin 7? It seems there is no more Window.open() method.
PS: I don´t want to use a Link. I want, for example, to open a new browser window when the user click some button.
Regards,
Fabiano
Hi Fabiano, you may take a look at the following page of book of vaadin (scroll down a bit on the page):
https://vaadin.com/book/vaadin7/-/page/advanced.html
Fabiano,
Did you want to open a window for your Vaadin app’s content? Or did you want a window for some other URL outside of your Vaadin app?
For both questions, the answer is
BrowserWindowOpener
. For Vaadin app content in another wonder, pass to the constructor the name of your UI subclass. For external content, pass to the constructor a String of the desired URL.
For more info and example code, see my other Forum
posting
.
There are many ways:
How to open local file in vaadin??
Can I use this getUI().getPage().open(“file:///C:/Program Files (x86)/PuTTY/putty.exe”, “_blank”,true); ??
But it is not working!!
Vaadin 8.
getPage().Open()
did not work.
Using this instead:
JavaScript.getCurrent().execute
(
String.format
(
"window.open('file:///%s', '_blank');",
webAutoTestDeamon.autotestLog.getAbsolutePath()
)
);
… but did not work either
Laurent de Laprade:
Vaadin 8.
getPage().Open()
did not work.Using this instead:
JavaScript.getCurrent().execute ( String.format ( "window.open('file:///%s', '_blank');", webAutoTestDeamon.autotestLog.getAbsolutePath() ) );
… but did not work either
i know the post is old, but u can try this:
Button button = new Button("Open URL in new tab"); //need a button
Anchor url = new Anchor("your link here!!"); // and anchor with a href link
url.setTarget("_blank"); //this is to open in a new tab
url.add(button); //add your button here
add(url);
hope this help you.