Jump to content

[RESOLVED] Opening the PDF in a new window rather than downloading it


Recommended Posts

Posted (edited)

I have set for the link

target=“_blank”

Despite this (and the appropriate settings in the browser), it does not open the PDF, but downloads it to disk.

How can I make the PDF open and not download? I have PS 8.1.4

Edited by Thommen (see edit history)
Link to comment
Share on other sites

il y a 5 minutes, Thommen a dit :

How to effectively enforce it? What does it depend on, besides browser settings? The only option I've seen online is

target="_blank"

 

Yes this is the option but you need to change php core admin templates 😞 

Link to comment
Share on other sites

  • Thommen changed the title to [RESOLVED] Opening the PDF in a new window rather than downloading it
Posted (edited)

I don't quite understand what the problem is. I moved from PS 1.7 to PS 8.1, and I had an image and a PDF placed in the /upload directory. For these files I had a page where the image gallery and links to the PDF were placed.

It stopped working for me i.e. not being logged in I could not see the graphics and the links to the PDF did not respond. I moved the /upload directory to /img/cms/upload. I replaced the links, everything started to work smoothly even will not be logged in, but the PDF files did not open (Chrome browsers). Firefox opened PDF.

Eventually (and this is strange) to open PDF I had to rewrite the page. So, I uploaded the graphics and PDF to the /img/cms/ directory (not the /img/cms/upload directory because then the PDF opening didn't work) via the file manager in PS (not via FTP|SSH). Then I had to attach the PDF to the graphics.

I could afford to do this because the gallery consisted of 8 graphics.

 

Edit

I've tracked down what's messing with my installation.

PS generates .htaccess, and in it we have an entry:
 

RewriteRule ^upload/.+$ %{ENV:REWRITEBASE}index.php [QSA,L].

Also added is /upload/.htaccess (to make it work for this directory)

<IfModule mod_headers.c>
    <FilesMatch "\.pdf$">
      Header set Content-Type "application/pdf"
      Header set Content-Disposition "inline"
    </FilesMatch>
</IfModule>

 

Edited by Thommen (see edit history)
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...