How do I force files to open in the browser instead of downloading (PDF)?

后端 未结 13 1263
别跟我提以往
别跟我提以往 2020-11-22 04:15

Is there a way to force PDF files to open in the browser when the option \"Display PDF in browser\" is unchecked?

I tried using the embed tag and an iframe, but it o

13条回答
  •  無奈伤痛
    2020-11-22 05:07

    While the following works well on firefox, it DOES NOT work on chrome and mobile browsers.

    Content-Type: application/pdf
    Content-Disposition: inline; filename="filename.pdf"
    

    To fix the chrome & mobile browsers error, do the following:

    • Store your files on a directory in your project
    • Use the google PDF Viewer

    Google PDF Viewer can be used as so:

    
    

提交回复
热议问题