Saturday, 16 February 2019

Google Chrome 37 sometimes opens PDF in PDF viewer plugin and sometimes downloads PDF


I am using Google Chrome Version 37.0.2062.103 on Windows 8.1 Pro. When I got to this page with two PDFs and left click on both of them, I get different results. The Texas Instruments datasheet opens in Google's built-in PDF reader. Chrome offers to download the schematic diagram.


If in the download dialog at the bottom, I click the downarrow and choose "Always open files of this type" the behavior for both PDFs is the same. I tried this both before and after clearing my download history in Google Chrome.


What is causing this behavior difference between the two PDFs?



Answer



It's something they are doing on the server-side, depending on whatever headers are returned to the client, you can allow a PDF to be viewed using the default behaviour, or you can force the client to download it. See this page on one way it can be implemented.


In this case, it doesn't look like it was intentional. If you look at the headers being returned for both of those links they have different 'content types'. The first has the content type application/pdf, and the second one has application/octet-stream. Chrome recognizes that it can open application/pdf with its built in PDF viewer, but not the content type application/octet-stream, so it just downloads it instead.


What can you do about it? Not much. There might be extensions that will get around this, but I haven't ever found one.


No comments:

Post a Comment

How can I VLOOKUP in multiple Excel documents?

I am trying to VLOOKUP reference data with around 400 seperate Excel files. Is it possible to do this in a quick way rather than doing it m...