Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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.

enter image description here

like image 672
Michael Avatar asked Sep 24 '14 21:09

Michael


3 Answers

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

like image 77
Lucas NN Avatar answered Nov 16 '22 08:11

Lucas NN


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.

like image 9
rand'Chris Avatar answered Nov 16 '22 06:11

rand'Chris


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.

Edge: Navigation occurred. DOCTYPE expected.

like image 8
pallxk Avatar answered Nov 16 '22 07:11

pallxk