homepage Welcome to WebmasterWorld Guest from 54.167.182.201
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member
Home / Forums Index / Browsers / Firefox Browser Usage and Support
Forum Library, Charter, Moderators: incrediBILL

Firefox Browser Usage and Support Forum

    
Mozilla Firefox Problem with Perl
mozilla just renders the code
Jakes Redding

5+ Year Member



 
Msg#: 3238848 posted 9:51 pm on Jan 31, 2007 (gmt 0)

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

WebmasterWorld Senior Member 10+ Year Member



 
Msg#: 3238848 posted 10:22 pm on Jan 31, 2007 (gmt 0)

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

5+ Year Member



 
Msg#: 3238848 posted 10:33 pm on Jan 31, 2007 (gmt 0)

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

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



 
Msg#: 3238848 posted 1:01 am on Feb 1, 2007 (gmt 0)

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

5+ Year Member



 
Msg#: 3238848 posted 1:51 am on Feb 1, 2007 (gmt 0)

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

5+ Year Member



 
Msg#: 3238848 posted 2:40 am on Feb 1, 2007 (gmt 0)

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

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



 
Msg#: 3238848 posted 4:51 am on Feb 1, 2007 (gmt 0)

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

Jakes Redding

5+ Year Member



 
Msg#: 3238848 posted 7:33 am on Feb 1, 2007 (gmt 0)

phranque,

Deleting that line got me an internal server error.

coopster

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



 
Msg#: 3238848 posted 4:07 pm on Feb 1, 2007 (gmt 0)

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

5+ Year Member



 
Msg#: 3238848 posted 9:57 pm on Feb 1, 2007 (gmt 0)

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

coopster

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



 
Msg#: 3238848 posted 1:45 am on Feb 2, 2007 (gmt 0)

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

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Browsers / Firefox Browser Usage and Support
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved