FileDownloader doesn't work on IE 11

I create a FileDownloader to let the user download some files from my web application. It works well on Chrome and Firefox, but impossible to use it on Internet Explorer 11.

Here’s my code :

StreamResource resource = new StreamResource(() → {
return documentTemplateService.getFile(item.getFilename(), item.getModule());
}, item.getFilename());
resource.getStream().setParameter(“Content-Disposition”, “attachment;filename="” + item.getFilename() + “"”);

Button download = new Button();
FileDownloader fileDownloader = new FileDownloader(resource);
[/code]I also try it without adding the parameters, mimetype and cachetime. But the result is the same.

Thank you for your reply.

I don’t have found a solution yet, but I find some interesting things.

The following line of code is useless, because the StreamResource will create a new DownloadStream when the user clicks on the button. So this parameter won’t be transmitted to the DownloadStream, and by default the DownloadStream add it by itself.

resource.getStream().setParameter("Content-Disposition", "attachment;filename=\"" + item.getFilename() + "\""); StreamResource source code (from Vaadin) :

    public DownloadStream getStream() {
        final StreamSource ss = getStreamSource();
        if (ss == null) {
            return null;
        final DownloadStream ds = new DownloadStream(ss.getStream(),
                getMIMEType(), getFilename());
        return ds;

DownloadStream add a Content-Disposition

                // suggest local filename from DownloadStream if
                // Content-Disposition
                // not explicitly set
                String contentDispositionValue = getParameter("Content-Disposition");
                if (contentDispositionValue == null) {
                    contentDispositionValue = "filename=\"" + getFileName()
                            + "\"";

But I didn’t find any solutions to be able to download a file with Internet Explorer, it works on Firefox and Google Chrome without any problems. I use a Windows 8.1 with Internet Explorer 11 and Vaadin 7.3.4.

I suspect that something is missing the response header data, but I don’t know what.

I’ve found some intersting thing when Internet Explorer try to download the file, in the Developer Tools (network tab) I can see this:

I think that IE doesn’t know when the response is done.

I try to implement my own FileDownloader and override the handleConnectorRequest to flush and close the outputstream and add my own header in the response, but still have the same issue.

My code:

public boolean handleConnectorRequest(VaadinRequest request, VaadinResponse response, String path) throws IOException {
VaadinSession session = getSession();
Resource resource = getFileDownloadResource();
DownloadStream stream = ((ConnectorResource) resource).getStream();

response.setHeader("Content-Disposition", "attachment; filename=\"" + stream.getFileName() + "\"");
response.setHeader("Cache-Control", "no-cache, no-store, max-age=0, must-revalidate");
response.setHeader("Pragma", "no-cache");
response.setHeader("Expires", "0");
response.setHeader("Content-Transfer-Encoding", "binary");
response.setHeader("My-Header", "yes");
final byte buffer = new byte[32 * 1024]


InputStream data = stream.getStream();
OutputStream out = response.getOutputStream();
int contentLength = 0;
for (int length = 0; (length = > 0;) {
    contentLength += length;
    out.write(buffer, 0, length);
response.setHeader("Content-Length", String.valueOf(contentLength));

return true;

[/code]And if I try to reach directly the url (/app/APP/connector/0/72/dl/template.docx), I receive my document and the header that I put in my own FileDownloader.

I’ve found one workaround to be able to use the FileDownloader with Internet Explorer.

                FileDownloader fileDownloader = new FileDownloader(resource) {
                    private static final long serialVersionUID = 1L;

                    public boolean handleConnectorRequest(VaadinRequest request, VaadinResponse response, String path) throws IOException {
                        if (Page.getCurrent().getWebBrowser().isIE()) {
                            Page.getCurrent().open(resource, "Name", false);
                            return true;
                        } else {
                            return super.handleConnectorRequest(request, response, path);

I know that the Page.getCurrent().open is deprecated, but it’s the only solution that I’ve found.

If somebody has a better alternative, please add it to this thread.

Thanks for the post. I was banging my head for the past couple of days with FileDownloader for IE10 on Win 7.
Nothing worked. The only solution that worked is the one you posted with the call to Page.getCurrent().open(…)

I had a similar problem.
If by any chance some of you are using Spring Security, you may find my solution useful.

Thanks! I figured it out a few days ago after having similar issue with Safari. Adding

http.headers().addHeaderWriter(new XFrameOptionsHeaderWriter(XFrameOptionsHeaderWriter.XFrameOptionsMode.SAMEORIGIN)); to Spring boot security configuration solved issue for both IE and Safari, so downloads now work as expected.