![Shanna517](https://vmapp.org/images/player/000default.jpg)
: HTTP Header broken? Browsers don't open our pdf, but open all other pdfs My Firefox and Chrome usually open PDF files very nicely, without asking and within the browser window. When clicking
My Firefox and Chrome usually open PDF files very nicely, without asking and within the browser window.
When clicking on a link to a PDF on our own website:
Firefox asks if it should download them, to see it I need to open the download history.
Chrome downloads it automatically, but here as well, opening the PDF needs an extra click.
If I copy the PDF to a different Server (Django installation with lighttpd), Firefox and Chrome will display it nicely as usual.
What's wrong?
More posts by @Shanna517
2 Comments
Sorted by latest first Latest Oldest Best
The solution was rather special.
The server had the default mime-type application/octet-stream for PDF files. After changing this to application/pdf everything worked fine.
In the lighttpd configuration I achieved the change by adding this definition:
mimetype.assign += ( ".pdf" => "application/pdf" )
See How to force files to open in browser instead of download (pdf)? which has an answer from ColinM that tells you exactly what the headers should be:
To indicate to the browser that the file should be viewed in the browser:
Content-Type: application/pdf
Content-Disposition: inline; filename="filename.pdf"
To have the file downloaded rather than viewed:
Content-Type: application/pdf
Content-Disposition: attachment; filename="filename.pdf"
EDIT: The quotes around the filename are required if the filename contains special characters such as filename[1].pdf which may otherwise break the browser's ability to handle the response.
Terms of Use Create Support ticket Your support tickets Stock Market News! © vmapp.org2025 All Rights reserved.