Re: Session with various Browser.
| From: | Justin French | Date: | Fri, 19 Sep 2003 04:39:21 +0000 |
| Subject: | Re: Session with various Browser. | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-163095@lists.php.net to get a copy of this message | ||
I think the problem is that session_start() (or something else you do before sending the header("content-type:application/pdf")) might confuse some browsers with both a text/html header and an application/pdf header. Essentially you might be sending cookie information to a PDF plug-in, and the browser get's confused.
The fact that Mozilla is still displaying it doesn't necessarily mean that your code is right, and that the other browsers are wrong -- it probably means that Mozilla is more forgiving that the others.
Think through your application. Should a PDF file have session information in it? Not as far as I can tell.
My guess is remove the session_start() line, because it's more than likely setting, or looking for cookie information, and tricking most browsers into expecting a web page (text/html), not a PDF.
Re-enforcing this is the fact that (AFAIK) no Mac browsers display in-line PDFs via a plug-in -- they open 'Acrobat' or 'Preview' to display them -- in other words, the PDF file should not be considered part of the web application, therefor does not require session headers.
However, this is all just a guess :)
Try to make sure it's session_start() causing the problem by repeating the error in a small, focused script without OB complications (for example).
Cheers,
Justin
On Friday, September 19, 2003, at 12:53 PM, Harry Yau wrote:
Hi all,I am new to php. At first, I wrote a php script to generate a pdffile from a tex file and load that pdf file to the browser by call a system call of latex -pdftex. After loading the pdf file. I wrote a function to remove all temp file created by latex. It work fine and it did all I expected. The php script work on IE 5, Netscape 4.79 and Mozilla 5.0.However, when I've tried to add a command "session_start" at the beginning of my script and even did set and get those session variables,different functionility of the php script MISSed upon different browse.On Netscape 4.79, it does generate the pdf file and remove thosetemp file, but loading the pdf file to the browser. The Netscape keeps complainning about the pdf file is damaged and could not be repaired.On IE5, the script does load the pdf file, but it does not removethose temp file.Nevertheless, on Mozilla, it works fine for me!! For not loading the pdf on netscape, I thought it is because thescript does some output to the browser before I call "header("content-type:application/pdf");" Therefore, I put "ob_start()" before starting session and call "ob_end_clean()" before setting the header for pdf content. It does not correct the problem.I am wondering what exactly the "session_start()" does? How it canhave different effect upon various browser? Of simply, please tell me how to correct those problems!~Thank You Very Much!~Best Regards, Harry Yau -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php --- [This E-mail scanned for viruses]