3.5.22. Opening External URLs
WebBrowserTools is a utility bean for opening external URLs. While the BrowserFrame component displays embedded web pages within the application, WebBrowserTools enables accessing external URLs in a user’s web browser tab.
WebBrowserTools is a functional interface that contains a single method: void showWebPage(String url, @Nullable Map<String, Object> params).
@Inject
private WebBrowserTools webBrowserTools;
@Subscribe("button")
public void onButtonClick(Button.ClickEvent event) {
webBrowserTools.showWebPage("https://cuba-platform.com", ParamsMap.of("_target", "blank"));
}
The showWebPage() method may take optional parameters:
-
target- String value used as the target name in awindow.opencall in the client. This means that only the values"_blank","_self","_top", and"_parent"will be considered. If not specified,"_blank"is used. -
width- Integer value specifying the width of the browser window in pixels. -
height- Integer value specifying the height of the browser window in pixels. -
border- String value specifying the border style of the window of the browser window. Possible values are"DEFAULT","MINIMAL","NONE".
|
For example, to open a URL directly from a menu item you should create a class implementing
See more on |