• Resolved leakplan

    (@leakplan)


    Hi

    I’m trying to achieve that the pdf-files of my website are directly downloaded and never opened in the browser.
    I already achieved that the pdf-file is downloaded but it’s still opened simultaneously in firefox. In chrome it’s not opened simultaneously but as soon as I click on the file in the “download bar” of the browser it is opened in the browser too.

    I achieved the forced download with the following code in the .htaccess-file:

    # Force file download
    <FilesMatch "\.(pdf)$">
    	ForceType application/octet-stream
    	Header set Content-Disposition attachment
    </FilesMatch>
    # END
    
    AddType application/octet-stream .pdf 

    Is there a way to force that the pdf-file has to be opened in the system viewer?

    Thank you for your help.

    Best regards

    • This topic was modified 1 year, 8 months ago by leakplan.
Viewing 2 replies - 1 through 2 (of 2 total)
  • A web page cannot determine in which application a file is opened. The way to force a download is the only thing you can influence. Everything behind that is no longer in browser hands.

    Thread Starter leakplan

    (@leakplan)

    @threadi Thank you for your response.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Force pdf-file to not open in browser’ is closed to new replies.