I had the same problem. I solved it with a hidden Embedded and overriding the resource MIME type to return “application/octect-stream”:
Layout stuff:
Embedded downloader = new Embedded();
downloader.setType(Embedded.TYPE_BROWSER);
downloader.setWidth("0px");
downloader.setHeight("0px");
layout.addComponent(downloader);
Resource stuff:
FileResource fr = new FileResource(myFile, getApplication()){
@Override
public String getMIMEType(){
return "application/octect-stream";
}
};
downloader.setSource(fr);
You can do this with any Resource type. You only have to override getMIMEType() method to return “application/octect-stream”. Otherwise file contents may be rendered into the embedded’s iframe.
I think this works because the main window location object never changes and close events are never fired to the server.