CodeIgniter Forums
How show a .PDF directly in a new tab - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived General Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=21)
+--- Thread: How show a .PDF directly in a new tab (/showthread.php?tid=13822)



How show a .PDF directly in a new tab - El Forum - 12-07-2008

[eluser]Pachat[/eluser]
With HTML, its trivial :
http://mysite.com/document/invoice/081002.pdf

But, for security reasons, the file is not under http, but somewhere upper, like here :
Code:
...
privatefiles/invoices/081002.pdf
...
www
   ...
   mysite
   ...

I based my download helper on CI donwload helper by placing
MY_download_helper.php in system/applcation/helpers

In this file, I changed in the force_download function "attachment" by "inline" in the following line :
Code:
header('Content-Disposition: inline; filename="'.$filename.'"');

But FireFox (or IE) still asks me if I want to see the file or download it, and then only shows it in a new window.

Is there a way with CI to have the file open directly in a new tab by just one click?


How show a .PDF directly in a new tab - El Forum - 12-07-2008

[eluser]thinkigniter[/eluser]
Try
Malsup Juery Media Plugin

this should work as a tab option


How show a .PDF directly in a new tab - El Forum - 12-08-2008

[eluser]Pachat[/eluser]
Thank for your answer.
Finally, I found easier to rely on the "natural" mechanism of the browsers by copying the file temporarily to a random subdir under www