Chrome says: "Resource interpreted as Document but transferred with MIME type application/vnd.openxmlformats-officedocument.wordprocessingml.document"
Solution 1
Don't worry about the Chrome warning. You are using a valid MIME Type for .docx files.
Solution 2
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.
Solution 3
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.
Michael
Updated on December 01, 2020Comments
-
Michael over 3 years
I am offering a file for download from my site, which is working. However, I am noticing this behavior from Chrome.
I think I have the correct MIME Type set but Chrome is showing this message and also marks the request in red.
The MIME type I have set is:
application/vnd.openxmlformats-officedocument.wordprocessingml.document
Is this the expected behavior for
*.docx
files? It seems like I may be doing something wrong.-
rand'Chris over 9 yearsIs this a dynamic download or a static one? According to this you can add the "download" attribute to the <a> tag. I'm seeing the same thing with application/pdf but (a) the PDF renders/downloads fine, and (b) it's dynamically generated so I have no <a> tag.
-
Michael over 9 yearsThis is a dynamic download.
-
-
Ilya Kushlianski over 6 yearsIt did not follow the link and issued a warning on localhost on my PC when I switched to Chrome's mobile mode in browser. But when I launched it locally on my mobile and tapped the link which leads to my CV, it worked perfectly.
-
cowbert over 5 yearsif the server is using HTTP/1.1 Chunked response it shouldn't be setting Content-Length anyway. So Chrome is a bit broken if it cannot stream an octet-stream properly that way...
-
Константин Ван over 4 yearsChrome seemingly does not suppress the warning if the resource to download does not have the same origin. Is this an expected behavior specified in the spec? -- Oh yea, thinking about it, it’s an obvious security feature: that way nobody can download resources you don't own as types you want it to be.