Download FileResource

Hello,

if I want to download a file, always get the message that the browser has prevented a pop-up window opens.

How can I handle this?

Here is my Code:
[b]

Button btn = new Button(“Download”, new ClickListener()
{
public void buttonClick(ClickEvent event)
{
download();
}
});
layout.addComponent(btn);

protected void download()
{
File downloadFile = new File(path);
FileResource resource = new FileResource(downloadFile, getMainWindow()
.getApplication());

	getMainWindow().open(resource, "_blank");
}

[/b]

Yeah, that’s a common problem that is mostly out of the control of the developer (There would be no point in the blocker if we could go round it, would there?). Most of the time I ‘solve’ it by opening the stream in the same window (so remove the string parameter). This is usually more acceptable for most browsers.