【问题标题】:Internet Explorer opens Word file corruptedInternet Explorer 打开损坏的 Word 文件
【发布时间】:2015-12-08 09:49:59
【问题描述】:

我在本地存储中上传了一个单词文件“confirm.docx”。我只需通过在href 给出它的路径来下载它。它在 Chrome 和 Firefox 中完美运行。当我单击按钮时,文件被下载。但是在资源管理器中,它会打开一个带有损坏字符的新选项卡,例如:

PK!ð!ì}Ž[Content_Types].xml ¢( ´”MOÂ@†ï&þ‡f¯¦]ð`Œ¡pP×$

我用于下载文件的 HTML 代码是:

<a href="/project/api/public/document/content/confirm.docx"
    target="_blank" class="">Download Agreement</a>

可能是什么问题?

【问题讨论】:

  • “本地存储”到底是什么意思?浏览器的本地存储只支持字符串。

标签: internet-explorer download ms-word docx


【解决方案1】:

我遇到了同样的问题并找到了答案: 我将此添加到 .htaccess

<FilesMatch "\.(?i:docx)$">
ForceType application/octet-stream
Header set Content-Disposition attachment
</FilesMatch>

我在这里找到它:http://www.tipsandtricks-hq.com/forum/topic/force-a-file-to-download-instead-of-showing-up-in-the-browser

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2014-07-09
    • 2017-06-26
    • 2015-06-29
    • 1970-01-01
    • 2014-11-27
    • 1970-01-01
    • 2020-01-21
    • 2014-07-18
    相关资源
    最近更新 更多