Forum Moderators: coopster & phranque

Message Too Old, No Replies

perl script is displaying html as text in firefox

IE renders HTML properly. Can't find problem

         

lgn1

10:43 pm on Nov 9, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I have a PHP script which calls a perl script.

The perl script renders some HTML, and works fine in IE.

In Firefox however, the script just displays the text instead of rendering the html.

Any ideas?

Dabrowski

11:13 pm on Nov 9, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I think this may be a mime type error, IE will try to auto detect the MIME type if the server sends none.

Make sure you're sending:

Content-type: text/html;\n\n

Before anything else. The 2 line breaks are important.

[edited by: Dabrowski at 11:14 pm (utc) on Nov. 9, 2007]

lgn1

4:32 am on Nov 10, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Already checked that, no luck.

I checked the headers with live headers in firefox and httpsniffer in IE. IE sends text/html, but firefox sends a text/plain and I have no idea where it is coming from.

if perl script calls another perl script no problem, but when php calls perl script, i get the problem, strange.

Has anybody had a php script call a perl script in the Firefox browswer?

perl_diver

6:25 am on Nov 10, 2007 (gmt 0)

10+ Year Member



Can we see the perl code or the relevant part of the perl code?

phranque

11:14 am on Nov 10, 2007 (gmt 0)

WebmasterWorld Administrator 10+ Year Member Top Contributors Of The Month



i think it is safe to say that ie & ff are seeing the same content since all the perl and php processing is necessarily occurring on the server.
(also assuming one of the scripts or the server isn't doing some type of browser cloaking.)
i would bet my money on:
they are probably both getting text/plain and ie is making some assumptions that it knows better and is modifying the header.

lgn1

2:48 pm on Nov 10, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Well I feel stupid. An amateur mistake.

I spelled Content-type as Context-type

Its been that way for several years, and I could not see it.

I guess it takes a new browser to shake you up.

Dabrowski

6:13 pm on Nov 11, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



;)

Nevermind, we all make them! Glad you sorted it.

phranque

6:40 am on Nov 13, 2007 (gmt 0)

WebmasterWorld Administrator 10+ Year Member Top Contributors Of The Month



i just noticed that here on WebmasterWorld there is a tool to check HTTP response headers [webmasterworld.com].

i usually use lwp-request for this but i thought others may benefit...