Take the 2-minute tour ×
Ask Different is a question and answer site for power users of Apple hardware and software. It's 100% free, no registration required.

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.

share|improve this question
5  
Can you provide a link to a file which has this behaviour? My guts tell me it is the webserver/host, not Safari. –  CousinCocaine Jul 3 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 Jul 3 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) –  CousinCocaine Jul 3 at 12:21
    
In analyzing the .pdf.exe file does it contains active links? –  Buscar웃 Jul 3 at 12:43
1  
Does Mac B have VMWare or Parallels installed? –  Alan Shutko Jul 3 at 16:03
show 4 more comments

2 Answers 2

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

share|improve this answer
add comment

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.

share|improve this answer
    
Brilliant. I was looking for an app that could do that. –  Alan Shutko Jul 4 at 0:33
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.