4

I have had reported on occasions when Safari on Mac is downloading a PDF from one of our sites it will append .EXE to the end of the file. The MIME type is correctly set to be pdf but it still does it occasionally.

I have found http://support.apple.com/kb/TA24293 which seems to indicate that this is a known issue with Safari on Mac however as official as this is (Since it is from Apple themselves) our clients don't seem to want to believe it. So I want to know if there is a solution to this problem?

I say "occasionally" because we have some Macs that this is happening on and some it's not. So maybe it's a setting or something, it downloads perfectly fine in IE, Firefox, Chrome and even downloads fine on mobile Safari. It is just Mac Safari.

9
  • 5
    Can you provide a link to a file which has this behaviour? My guts tell me it is the webserver/host, not Safari. Commented Jul 3, 2014 at 12:11
  • Unfortunately to get access to download these pdf files you need an account and unfortunately we can't create a test account on our LIVE servers we can only create test accounts on our TEST servers and again unfortunately due to security reasons I can't give that address away. If you tell me what you think I should be looking for I can check and tell you
    – Popeye
    Commented Jul 3, 2014 at 12:18
  • Just the pdf. If it is Safari, it will not matter if my host or your host will serve the file, right? Usually the host tells the client what filetype to expect. Safari can not guess the filetype, it needs to be told. So the PDF is corrupt or the host. (...is what I think) Commented Jul 3, 2014 at 12:21
  • In analyzing the .pdf.exe file does it contains active links?
    – Ruskes
    Commented Jul 3, 2014 at 12:43
  • 1
    Does Mac B have VMWare or Parallels installed? Commented Jul 3, 2014 at 16:03

3 Answers 3

10

HTTP Header: Content-Disposition

Have the server include an additional Content-Disposition header when serving the PDFs:

Content-Disposition: attachment; filename="<MyPDF.pdf>"

This provides the browser with a strong suggestion for the desired filename and suffix. See How to encode the filename parameter of Content-Disposition header in HTTP? for a discussion about limitations and implementing this feature.

MIME Type

Additionally, make sure the server's PDF mime type in the Content-Type: header is set correctly. There are variations in use. application/pdf is the recommended type.

The standard MIME type is application/pdf. The assignment is defined in RFC 3778, The application/pdf Media Type, referenced from the MIME Media Types registry.

Test with curl

Use curl -I http://example.com/mypdf.pdf to test and ensure the correct headers are returned by your server. curl can provide credentials to work as a logged in user.

Potentially related question: When sending headers to download a PDF, Safari appends .html

2

Just a blind guess:

On the Macs with the issue, install RCDefaultApp, and use it to check if the settings for the mime type and .pdf extension are correct. Could be that they're linked to a Windows VM, for instance.

1
  • Brilliant. I was looking for an app that could do that. Commented Jul 4, 2014 at 0:33
-2

Download the file, then double click on it and choose Open With. Under this menu, select any app capable of opening PDFs like Adobe Reader and the file will open.

1
  • How does this resolve the problem. The issue isn't how to open it the issue is why is it happening and how to stop it happening. Following the steps you are saying to do will not open it and will cause an error because the file is of extension .EXE and not .pdf. Please read the question carefully.
    – Popeye
    Commented Jun 25, 2015 at 7:00

You must log in to answer this question.

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