I have PDF file for download by users on my website.
Is there a way to instruct Chrome not to view the PDF in the users browser when the user clicks the link to the PDF, but instead download the PDF to the users download folder instead? Or at least instruct Chrome to ask the user whether he wants to view the PDF in the browser or download it (rather than just viewing in browser automatically) ?
Thanks :)
Content-Dispositionheader mentioned in the link in the first comment is the right way to do this. – heavyd Jan 24 '15 at 09:54Content-Dispositionis certainly the way to go (as already mentioned), but that solution on WordPress/.htaccess is not necessarily correct. TheContent-Typeshould not be set toapplication/octet-stream, in an attempt to fool the browser. (Not sure why this question was migrated from Webmasters, it is programming related, entirely to do with the HTTP response headers as sent from the server.) – MrWhite Jan 24 '15 at 12:01