Welcome to WebmasterWorld Guest from 54.160.163.163

Forum Moderators: incrediBILL

Message Too Old, No Replies

Mozilla Firefox Problem with Perl

mozilla just renders the code

     

Jakes Redding

9:51 pm on Jan 31, 2007 (gmt 0)

5+ Year Member



Hello,

I’m having a problem with a perl script that gathers and emails form data and then returns a Thank You page to the user. The problem may actually be with the browser as it works fine in IE6 and 7 but not in Mozilla Firefox. In Firefox, the Thank You page is just rendered as HTML code. However, the form data is still sent by email. Any ideas how I can fix this?

choster

10:22 pm on Jan 31, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Check the MIME type of the thank you page. If you are outputting, for instance, text/plain , Firefox will display it as text/plain. Internet Explorer, on the other hand, often tries to be "helpful" by guessing at the intended output, which is presumably text/html here.

Jakes Redding

10:33 pm on Jan 31, 2007 (gmt 0)

5+ Year Member



Thanks choster,

I’m using the same content-type as the other pages:

<meta http-equiv=”Content-Type” content=”text/html; charset=iso-8859-1” />

Anything else I should check?

jdMorgan

1:01 am on Feb 1, 2007 (gmt 0)

WebmasterWorld Senior Member jdmorgan is a WebmasterWorld Top Contributor of All Time 10+ Year Member



Use the "Live HTTP Headers" extension to Firefox and check the server response headers, not the page header. It is likely you'll find that your PERL script is not outputting the correct MIME-type header -- or any header at all, possibly.

Look for this line (or something like it) in your script:


print ("Content-type: text/html\n\n");

Jim

Jakes Redding

1:51 am on Feb 1, 2007 (gmt 0)

5+ Year Member



Hello Jim,

The thank you note is a regular html page enclosed in a subroutine. Here’s the code, minus the content.

sub thank_you {

print <<EndStart;

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Sample Request Thank You</title>
</head>
<body>
</body>
</html>

EndStart

exit(0);
}

Does the doc type declaration make a difference?

Jakes Redding

2:40 am on Feb 1, 2007 (gmt 0)

5+ Year Member



Hello Jim,

Maybe we’re on to something.

Downloaded the "Live HTTP Headers" extension as you suggested.

For the “Thank You Page” returned by the perl script, here’s what comes up under Page Info>Headers>Response Headers:

Response: HTTP/1.1 200 OK
Date: whatever
Server: Apache/1.3.33 (Unix)
Keep-Alive: timeout=2, max=200
Connection: Keep-Alive
Transfer-Encoding: chunked
Content-Type: text/plain

Is the problem the Content-Type: text/plain? Should it be text/html? If so, how do I change it?

Does it matter that I ftp’d the perl script as ASCII not binary?

phranque

4:51 am on Feb 1, 2007 (gmt 0)

WebmasterWorld Administrator phranque is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month



maybe it's that first blank line that gets printed before "<!DOCTYPE..."

Jakes Redding

7:33 am on Feb 1, 2007 (gmt 0)

5+ Year Member



phranque,

Deleting that line got me an internal server error.

coopster

4:07 pm on Feb 1, 2007 (gmt 0)

WebmasterWorld Administrator coopster is a WebmasterWorld Top Contributor of All Time 10+ Year Member



It's not the DOCTYPE, it's the
Content-Type
header that you need to print before any markup is sent. Print out the header first, then your HTML. Read jdMorgan's post again for the syntax.

Jakes Redding

9:57 pm on Feb 1, 2007 (gmt 0)

5+ Year Member



Yep, the content-type header did the trick. All is good. My thanks and appreciation to everyone.

coopster

1:45 am on Feb 2, 2007 (gmt 0)

WebmasterWorld Administrator coopster is a WebmasterWorld Top Contributor of All Time 10+ Year Member



On behalf of "everyone", you're welcome. And welcome to WebmasterWorld, Jakes Redding.
 

Featured Threads

Hot Threads This Week

Hot Threads This Month