6

I need to view and PDF file stored as an attachment inside an IFRAME in this context: Visualforce: Why the display of an PDF-File inside an IFRAME works on a Sandbox but not in Production?

Inspecting the Request-Header Details the server responds differently, but I can't understand why. Now I was able to nail down the exact difference, which is a different Content-Disposition header. I need it to be inline. On Sandbox I get Inline as desired but on Production I got Attachment which is very bad for what I want.

Here are the links:


Sandbox

https://MYDOMAIN_NAME--SANDBOX_NAME.cs87.my.salesforce.com/sfc/servlet.shepherd/document/download/CONTENTVERSION_ID?operationContext=S1

gets rewritten to

https://MYDOMAIN_NAME--SANDBOX_NAME--c.cs87.content.force.com/sfc/servlet.shepherd/document/download/CONTENTVERSION_ID?operationContext=S1

The response header becomes

Content-Disposition inline; filename="FILENAME.pdf"


Production

https://MYDOMAIN_NAME.my.salesforce.com/sfc/servlet.shepherd/document/download/CONTENTVERSION_ID?operationContext=S1

it does not get rewritten

and the response header becomes

Content-Disposition attachment; filename="FILENAME.pdf"


Question

Anyone knows how this can be tweaked to take control and get always the header to be either Inline or Attachment as needed?

0

Have you checked the File Upload and Download Security settings under: Setup > Security Controls > File Upload and Download Security

There is a row for PDF files. I believe you will want to change the Download Behavior to "Execute in Browser" to force the browser to display the PDF rather than downloading and saving the file on your computer.

Salesforce File Upload and Download Security settings

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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