Ralpharama Archive. The archive is almost 20 years old, this website is no longer maintained.
How to force an Amazon s3 bucket PDF to download, not open in browser
Hits 5209 | Created 2012-09-26 | Modified 2012-09-26This took a lot of figuring out :)
Go into s3 file manager and do properties on the file. Go to Metadata, add or edit the following keys:
Now when you hit the s3 url, the PDF will prompt to download, and not load in the browser or Adobe Reader.
If you want to hide the location of the file, or have it pop up on a click, you can try this code (sorry, I found and adapted it from the net somewhere, if you are the original author, let me know and I'll add a link to you)
<title>Click to save PDF example</title>
var now = false;
var elFoo = window.frames['loader_frame'].document.getElementById('external');
<iframe src="http://site.com/my.pdf" id="external" name="loader_frame" style="display:none;"></iframe>
This item has the following tags:
Useful? Donate for hosting costs
All content copyright (c) Ralpharama