简体   繁体   中英

Direct Download CSV file in IE 10 Open the file instead of download it

I have a link to download a file from the server like this:

<a id="downloadCSVFile" runat="server" href="javascript:void(0)" onclick="parent.document.location = 'CSVFile.csv';">Download</a>

And i try this:

<a id="downloadCSVFile" runat="server" href="CSVFile.csv">Download</a>

now my problem is that ONLY IE10 open the file instead of download it !!!!

Note: I am using i-frame

The problem is on your server.

You need to put the correct headers when serving the file, notably Content-Disposition of the following form:

Content-Disposition: attachment; filename=filename.csv

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM