问题
How do I close the current browser tab? The following aren't working.
JavaScript.getCurrent().execute("window.close();");
or
UI.getCurrent().removeWindow(window);
or
window.close();
回答1:
Try this:
Window appointmentWindow = getApplication().getWindow(NATIVE_WINDOW_NAME);
if (appointmentWindow != null) {
getApplication().removeWindow(appointmentWindow);
}
Source: https://vaadin.com/forum/#!/thread/235330
回答2:
Try this.
gBrowser.removeCurrentTab();
来源:https://stackoverflow.com/questions/17759411/how-to-close-current-browser-tab