FileDownloader on detach

There is a logic in my project: whenever I click button, it starts downloading file and closes window it is on. So the button is being detached from document also. At the same time component connector is removing iframe, being used as stream download link. So it dissapears faster then the download process begun if i’m downloading file from distant server.

@Override public void setParent(ServerConnector parent) { super.setParent(parent); if (parent == null && iframe != null) { //The place where iframe is being detached when the component is detached iframe.removeFromParent(); } } Quick fix idea I can imagine is to leave the iframe where it is, and remove it whenever we click
public void onClick(ClickEvent event)

I have this problem, FileDownloader make every time an iframe element on page when I click download, if I click download more time, every time the browser show download window more times…

I have hidden the download button: I use this code:

					fd = new FileDownloader(res);
							+ "document.getElementById('DownloadButtonID').style.display = 'none'");
					fd = null;

to start the download after data export activated by another button.