Google Chrome – Resource interpreted as document but transferred with mime type application/pdf

June 13, 2011

Ran into this funky error today when users weren’t able to download pdf’s from our server when using Google Chrome. And when doing a search online it seems that it affects alot of users. However I found out what the issue was and was able to resolve the issue server side.

I was alerted this morning that our users were getting an error when downloading PDF’s. In the download box at the bottom the PDF’s were showing an interrupted error. Looking into the error further I found that there was this more in depth error coming up.

Resource interpreted as document but transferred with mime type application/pdf.

After looking at the header coming from the IIs server I noticed that one of the headers was Transfer Encoding was chunked. Looking deeper into the issue. It seems that Google Chrome doesn’t handle that chunked encoding well. So it just cancels the download.

The fix on the server was to add the Content-Length header to the code.

Response.AddHeader(“Content-Length”, drDocument[“size”].ToString());

After adding the Content-Length header Google Chrome properly downloaded the file and displayed it normally.

I would of thought Google would of done a better job of handling that. However, it is what it is. And we are able to fix it via code.

Got something to say?

You must be logged in to post a comment.