How do I force files (like PDF or .jpeg) to be displayed directly in the browser instead of being downloaded?

 

If you have a link to an image or a file that you want to open within the browser rather than download to your local machine, you may need edit the metadata on the file to indicate that this should happen. 
The property named Content-Disposition controls this. If it is set to "attachment" it should be downloaded.  If Content-Disposition is set to "inline" that should cause it to be displayed within the browser. This may be subject to settings on some browsers, but that's the basics you will want to check. 
Please refer to https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Disposition for a bit more information on that. 

In order to see/edit those attributes, you will need an S3 application that makes them visible like:

Wasabi Explorer

The page would look like this:

mceclip0.png

Using the button Set HTTP Headers you will get a popup screen that enables you to add/edit/delete these attributes.

mceclip1.png

As you can see, we have a HTTP Header Content-Disposition set as inline.

If you can't find it in the list of headers, go ahead and create one.

S3 Browser

The page would look something like this: 

Above you can see in the HTTP Headers tab that the Content-Disposition Field is set to "inline". Edit that and you can change it to "attachment" to indicate that you want the behavior to change. 

 



Have more questions? Submit a request