Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
397 views
in Technique[技术] by (71.8m points)

java - How to close current browser tab?

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();
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Try this:

Window appointmentWindow = getApplication().getWindow(NATIVE_WINDOW_NAME);
if (appointmentWindow != null) {
   getApplication().removeWindow(appointmentWindow);
}

Source: https://vaadin.com/forum/#!/thread/235330


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...