Keyword

Open attachments in New Window

  • Marley Man
  • Marley Man's Avatar Topic Author
  • Offline
  • New Member
More
7 years 7 months ago #160518 by Marley Man
Open attachments in New Window was created by Marley Man
Hi, When we add a new item - using the "add attachments" we add PDF's.
We want all the PDF's to open in a new window, not force the user to download the PDF.

Can anyone tell me how to accomplish this?

thank you!

Please Log in or Create an account to join the conversation.

  • Krikor Boghossian
  • Krikor Boghossian's Avatar
  • Offline
  • Platinum Member
More
7 years 7 months ago #160543 by Krikor Boghossian
Replied by Krikor Boghossian on topic Open attachments in New Window
Hello,

By default all attachments are being forcibly downloaded.
In order to link to a document you can use an extrafield.

JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)

Please Log in or Create an account to join the conversation.

More
7 years 7 months ago #160565 by Peter
Replied by Peter on topic Open attachments in New Window

Krikor wrote: Hello,

By default all attachments are being forcibly downloaded.
In order to link to a document you can use an extrafield.


You can modify a file to do that but be aware a K2 update will remove your changes.
Open this file: administrator/components/com_k2/models/item.php
Search for this line:
JResponse::setHeader('Content-Disposition', 'attachment; filename='.$filename.';', true);
around line 1149
remove or comment it and add this after that:
JResponse::setHeader('Content-Disposition', ($handle->file_src_mime=='application/pdf'?'inline':'attachment').'; filename='.$filename.';', true);

It will open all of your pdf attachments inline.

For the developers: maybe it would be a good point to set which type of attachment should K2 open inlinde. It's a quite simple parameter in the config xml.

Please Log in or Create an account to join the conversation.

  • Krikor Boghossian
  • Krikor Boghossian's Avatar
  • Offline
  • Platinum Member
More
7 years 7 months ago #160575 by Krikor Boghossian
Replied by Krikor Boghossian on topic Open attachments in New Window
Thank you for your feedback Peter :)

JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)

Please Log in or Create an account to join the conversation.


Powered by Kunena Forum