Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>We had a similar case recently, and after checking a <a href="http://answers.microsoft.com/en-us/ie/forum/ie8-windows_other/internet-explorer-tries-to-download-aspx-pages/8413f3d5-5511-4b45-bc3f-86d059c7a44e" rel="nofollow">whole</a> <a href="http://answers.microsoft.com/en-us/ie/forum/ie8-windows_7/internet-explorer-downloading-htmhtml-instead-of/ea25e134-e476-4709-881c-fa6e85edefe2" rel="nofollow">bunch</a> <a href="http://answers.microsoft.com/en-us/ie/forum/ie9-windows_7/internet-explorer-89-tries-to-download-linked/9ddcfa31-c79c-4784-8aef-501d69ec43fd" rel="nofollow">of</a> <a href="http://answers.microsoft.com/en-us/ie/forum/ie8-windows_other/ie8-tries-to-download-a-webpage-as-a-file-instead/fc9d686d-f4e4-4bb8-bfa7-b0e0aed178c5" rel="nofollow">useless</a> <a href="http://answers.microsoft.com/en-us/ie/forum/ie8-windows_other/ie8-always-asks-save-or-download-wont-open-web/803dfe11-36e3-403d-ad57-664f2eb2d49e" rel="nofollow">answers</a> on the MS site, I came across an interesting <a href="http://blogs.msdn.com/b/ieinternals/archive/2009/10/02/internet-explorer-cannot-download-over-https-when-no-cache.aspx" rel="nofollow">blog post</a> that shed some more light on the issue, mainly about headers that prevent caching (including the <code>Vary</code> header that ended up solving the OP's problem, +1).</p> <p>However, IE throws this misleading exception in a number of other cases as well, so I thought I'd add this here in case it's useful to someone else encountering the same problem. In our case, it turned out that the author of the JSP that generated the (Excel) file and sent it to the response had forgotten to make sure that <em>no whitespace should preceed</em> the file contents in the response.</p> <p>In the case of Java/JSP files (I'm sure you can adapt the same principle to other languages), problems occur when you have something innocent-looking like:</p> <pre><code>&lt;%@ page contentType="text/html; charset="iso-8859-1" pageEncoding="iso-8859-1" errorPage="" language="java" session="true" %&gt; &lt;%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %&gt; [and so on] </code></pre> <p>i.e. have the carriage returns as part of the JSP directives instead of <em>between</em> them before you generate the file contents and send them to the response, because the carriage return between such lines is whitespace that manages to throw a virtual spanner in IE's delicate machinery (normal browsers seem to handle this just fine). If you instead format your code like this:</p> <pre><code>&lt;%@ page contentType="text/html; charset="iso-8859-1" pageEncoding="iso-8859-1" errorPage="" language="java" session="true" %&gt;&lt;%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %&gt;[and so on] </code></pre> <p>then you should be ok. I'm sure most web devs have come across similar issues, but in my case it had been a while and I had to look over the JSP a few times before noticing that one line wasn't doing that....</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload