For the majority of PDFs I view in Safari, they are opened in-line, which is what I want. For example, these all open in Safari:

However, some PDFs, for reasons I have not been able to determine, are instead downloaded. For example, when I click on each of the following links, a PDF is immediately downloaded, instead of being displayed in-browser.

I suspect that the servers for the last two links are doing something like what is described in the StackOverflow question "force a pdf download automatically", but I'm not sure. I have already removed the last vestiges of Adobe's PDF reader, which I regret ever installing, including the internet plugin in the /Library/Internet Plugins directory.

How can I make sure that whenever Safari encounters a PDF, it is opened in the browser, and not downloaded?

  • The first three are fully qualified URL's to the actual PDF document while the last two are not. I suspect that is the reason why the last two are being directly downloaded. Feb 22, 2015 at 22:47
  • More specifically, the server hosting the last two links is probably sending headers that cause Safari to treat the files as downloads instead of PDFs. There is no way to change this on your end.
    – tubedogg
    Feb 23, 2015 at 2:21
  • Could I not write a Safari extension that would detect and alter these sorts of headers?
    – ravron
    Feb 23, 2015 at 3:05

2 Answers 2


As pointed out, the first three examples are direct links to the PDF files in question while the other two are controlled by a server script in the background.

There is nothing what you can do about it on your side since the server fully controls the distribution of documents in the two last example links you provided.

  • Could you be more specific about what the "server script in the background" entails? If I have to hack together a Safari extension to fix this, it's not out of the question.
    – ravron
    Feb 22, 2015 at 23:52
  • Specifically looking at your last example, the PDF is delivered using a PHP script ("index.php"), which takes multiple parameters to deliver the document, namely: module, action, cmpref, width, height, format and alt. What this page is doing with it and how it signals the browser that the target document is not a PDF file, but a binary stream to download is beyond my knowledge.
    – Phoenix
    Feb 24, 2015 at 11:45
  • While the second-last example does not specifically specify what type of scripting page it is, using parameters (as indicated by the question mark ("?")), it also uses server-internal scripting to convey the information to clients.
    – Phoenix
    Feb 24, 2015 at 11:58

Recently I was not able to open any pdf inside safari-12 on Mojave, I tried a lot of things and spent lot of time with apple support. After two days the support was able to resolve my issue, here is what they did.

  1. Quit Safari
  2. Go to ~/Library/Containers
  3. Delete com.apple.safari

Reopen safari. This fixed the issue for me. Leaving it here if some one else faces this problem.

  • In case you wonder why you're being downvoted: this question was not about "not being able to open any pdf" at all. That is a totally different problem.
    – Fuzzy76
    Apr 21, 2022 at 9:16

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .