Chrome says: “Resource interpreted as Document but transferred with MIME type application/vnd.openxmlformats-officedocument.wordprocessingml.document”

微笑、不失礼 提交于 2019-12-03 01:10:58

Don't worry about the Chrome warning. You are using a valid MIME Type for .docx files.

According to this issue in the Chrome bug tracker, a commenter on January 29, 2014 states that this may be caused by a missing Content-Length header. It doesn't fix the problem for me, however, where I return a dynamically generated PDF based on a form POST.

If nothing else, maybe add to or star the issue there. It may be innocuous.

The MIME type for your file is correct and actually does not matter here.

If your file is put inside an <a> element (whether it's static or dynamic), you need to add the download attribute to squeeze the warning.

Something similar happens to Edge as well, and adding download attribute solves it as well.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!