file downloaded twice on IE8

When I set response content type as Excel, the Open/Save dialog is shown twice , just on IE8. It works fine on other browsers (tested on Chrome/Firefox/Opera).

The code for setting response content type is:

response.setContentType("application/vnd.ms-excel");
response.setHeader("Content-disposition","attachment;filename=abc.xls");

I searched for solutions/workarounds. Turning off Smartscreen didn't help. Also, another suggestion was to wait for 5-10 sec before clicking Save/Open. That too didn't work.

What's the cause of this? Are there any IE specific workarounds?

It's a pain but IE8 is still widely used by the users.


This is just a guess, but it could have something to do with the way Office (used to) embed itself in IE with plugins.

A workaround might be putting it in a zip file before sending it over to the user.

链接地址: http://www.djcxy.com/p/45470.html

上一篇: MIME类型中“vnd”的含义是什么?

下一篇: 文件在IE8上下载两次