Important Notice - Forums is archived
To simplify things and help our users to be more productive, we have archived the current forum and focus our efforts on helping developers on Stack Overflow. You can post new questions on Stack Overflow or join our Discord channel.

Vaadin lets you build secure, UX-first PWAs entirely in Java.
Free ebook & tutorial.
The method bind to Window.onload event will be fired when closing the sub-w
I am new to vaadin and now I'm facing this problem which I couldn't find any solution from any other topics or forums!
I have a bunch of code like this:
First, I have method to launch a sub-window
public static void previewFlowProcess(String procInstCode, Environment env) {
Window window = new ProcessComponent(procInstCode, env);
UI.getCurrent().addWindow(window);
}
Then, the constructor of the Sub-window object is like following:
public ProcessComponent(String processInstCode, Environment env){
this.browser = new BrowserFrame("Browser", new ExternalResource("http://localhost:8181/activiti-explorer/diagram-viewer/Test.jsp"));
browser.setWidth("950px");
browser.setHeight("600px");
bulidComponent();
}
So it will create a BrowserFrame to open an external resource, then while building the sub-window, the BrowserFrame will embeded to the sub-window.
Third, it's the code of method buildComponent()
private void bulidComponent() {
setCaption("Test");
setContent(browser);
center();
setModal(true);
setSizeUndefined();
}
And the external resource is a JSP with a method which will be called when window.onload event was captured:
<script>
window.onload = function () {
alert("call method")
}
</script>
My problem is that when I close the sub-window, the method bind to window.onload event will be called again, which means in this case: the "call method" message will be alerted again when I close the sub-window.
Does anyone here could give me some advises? Thanks a lot!!