title: Why doesn't IE show file download dialog for PDF with GWT Window.open()?
body: <p>We are generating PDF documents for our customers and serving them with a Servlet.
  The following code works with Firefox, Chrome and Opera, but not with any version of IE. The popup window only flashes with IE but nothing happens. However, we can get the file download dialog to show by making a direct request to the servlet from the address bar in IE.
  We've tried with several ContentTypes (application/download, application/x-download, etc.)</p>
  
  <p>Client side code:</p>
  
  <pre><code>String URL = "/files/pdf?pdfId=" + getPdfId();
  Window.open(URL, "_blank", "");
  </code></pre>
  
  <p>Servlet serving the pdf as byte[]:</p>
  
  <pre><code>byte[] bytes = getFileAsByteArray();
  BufferedInputStream in = new BufferedInputStream(new ByteArrayInputStream(bytes));
  BufferedOutputStream out = new BufferedOutputStream(response.getOutputStream());
  response.setHeader("Content-Disposition", "attachment; filename=document.pdf");
  response.setContentType("application/octet-stream");
  response.setContentLength(bytes.length);
  byte[] buffer = new byte[8192];
  for (int length = 0; (length = in.read(buffer)) &gt; 0;) {
      out.write(buffer, 0, length);
  }
  out.flush();
  out.close();
  </code></pre>
  
  <p>Any thoughts on this?</p>