Open PDF files on browser by default instead of prompting users to download.

Sometimes it might be more convenient for the user to just open a pdf document on the web browser instead of the classic popup prompting them to open or download the file. Although more advanced users know that there exists an option to always display pdf files on the browser side, it might be necessary to provide that option by default.


I did not know about this option even. For me it opens in browser, and then I can opt to download. Interesting, although not a complex problem.
Klaus Nigsch - Sun, 11/25/2018 - 13:23 :::
I know this problem, I experienced it a lot in the past time and I think this solution could help me one day :)
Andre Bernecker - Thu, 12/06/2018 - 15:58 :::
I did not know about this option either. Interesting. Thank you for easy and quick solution.
Malbora Sinaj - Sun, 12/09/2018 - 17:13 :::
Can you give the exact way to manage this option? Thank you for giving us this tip!
Kawtar Koutit - Sun, 12/09/2018 - 23:50 :::
I didn' know about this option before either, it is interesting and allow us to save some time.
Carole Sebah - Mon, 12/10/2018 - 17:00 :::
1 answer

You can use the following http headers:
Content-Type: application/pdf
Content-Disposition: inline; filename="filename.pdf"
This ensures that the browser will always display it on the browser window.



Very useful! Thanks for giving an explanation for this problem that most people will run into in web engineering at some point

Marian Berendes - Mon, 12/10/2018 - 10:58 :::