Re: [PHP] target question
[email protected] (Jim Giner)
| Newsgroups | php.general |
|---|---|
| Message-ID | <[email protected]> |
On 3/25/2013 1:12 PM, Samuel Lopes Grigolato wrote: > With the header "Content-Disposition: attachment" the browser will > offer the response as a regular file download (with save/open > options). Your original page (menu) will remain intact. > > Please note that this solution will not present the PDF directly to > the user (as it would with a popup window), instead he will need to > open the downloaded file in his computer. > > On Mon, Mar 25, 2013 at 12:23 PM, Jim Giner > <[email protected]> wrote: >> On 3/25/2013 10:13 AM, Samuel Lopes Grigolato wrote: >>> >>> Have you tried to set a Content-Disposition header in the PHP script that >>> creates the PDF, asking the browser to "attach" the download? This way you >>> don't even need a new window. >>> >>> Example from php.net/manual: >>> >>> // It will be called downloaded.pdf >>> header('Content-Disposition: attachment; filename="downloaded.pdf"'); >>> >>> >>> On Mon, Mar 25, 2013 at 11:01 AM, Jim Giner >>> <[email protected]>wrote: >>> >>>> target as in the form attribute >>>> >>>> In my appl devl I utilize an extra window when my current form is asked >>>> to >>>> generate a pdf report. Works well since that way the user can generate >>>> one >>>> report into a new window, read it, close it, and still have the reports >>>> menu in front of him/her and generate a 2nd report. >>>> >>>> I'm experiencing a problem tho and I'm guessing it's associated with ie9 >>>> or FPDF. In my reports menu form, when I click on a button that will >>>> generate a pdf, I alter the form's target to create a new window. This >>>> used to work last fall, but since then I have a new laptop running ie9, >>>> not >>>> 8. The target changing js logic is working as far as I can see (alerts >>>> in >>>> my js) but the effect is not there. Instead of a new window, the pdf >>>> opens >>>> up in the same window where the menu was and so when the user does a back >>>> he ends up going up one too many levels and has to re-request the reports >>>> menu. >>>> >>>> Didn't have this much trouble originally setting this up as I'm having >>>> now >>>> trying to debug this. I'm using the FPDF extension/class to generate my >>>> pdfs - made no recent changes there. Also my concept works very well >>>> still >>>> in a simple html document that has only two buttons on it which I created >>>> today to test a theory. That is - maybe it's not just IE9, but FPDF. >>>> >>>> Anyone have any experience in this area? >>>> >>>> -- >>>> PHP General Mailing List (http://www.php.net/) >>>> To unsubscribe, visit: http://www.php.net/unsub.php >>>> >>>> >>> >> And what happens to my original menu window? >> >> >> -- >> PHP General Mailing List (http://www.php.net/) >> To unsubscribe, visit: http://www.php.net/unsub.php >> Thanks for the pointer - but not what I'm looking to do. Trying to make it effortless for the user so having to go and open a pdf would be another pia.