Force to open “Save As…” popup open at text link click for PDF in HTML

后端 未结 18 1356
無奈伤痛
無奈伤痛 2020-11-22 10:28

I have some big size PDF catalogs at my website, and I need to link these as download. When I googled, I found such a thing noted below. It should open the \"Save As

18条回答
  •  耶瑟儿~
    2020-11-22 11:01

    Generally it happens, because some browsers settings or plug-ins directly open PDF in the same window like a simple web page.

    The following might help you. I have done it in PHP a few years back. But currently I'm not working on that platform.

    Error 404: File Not Found: 
    $file"; } ?>

    Save the above as download.php.

    Save this little snippet as a PHP file somewhere on your server and you can use it to make a file download in the browser, rather than display directly. If you want to serve files other than PDF, remove or edit line 5.

    You can use it like so:

    Add the following link to your HTML file.

    Download the cool PDF.
    

    Reference from: This blog

提交回复
热议问题