Firefox and heredoc problem

P

phillyfan

I have a script with the code below in it. It works fine in IE, I know
the statement has been stated many times before, but does not display
correctly in Firefox.

Code:

#!/usr/bin/perl -w

use strict;
use POSIX;
use diagnostics;
use CGI qw:)all);
use Fcntl qw:)flock);
use DBI;
[...]

print << "WEB_PAGE";

<html>
<head>
<title>
UCR - $svcname $periodtime $rptype Report
</title>
<link REL="StyleSheet" TYPE="text/css"
HREF="http://$servername/css/angelica.css">
</head>
<body>
<div class=main>
<table cellpadding=5 border=1 align=center>
<tr>
<td colspan=10 align=center>
<p><B> $svcname $periodtime $rptype Report Summary</B></p>
<p>Requested by <B>$svcnum[1] $svcnum[2]</B><BR>
From $todate to $fromdate<BR>
As of $asoftime
</p></td>
</tr>
<tr>
<td class=header align=center>
Meter Serial Number
</td>
<td class=header align=center>
Meter Name
</td>
<td class=header align=center>
Meter Value
</td>
</tr>

</table>
<P><center><a class=body
href="http://$servername/cgi-bin/p/reports?opr=$opr">Go Back to Report
Parameters</A></center><P>
</div>
</body>
</html>
WEB_PAGE

Looking at the page IN IE it displays the HTML page as I intended. In
Firefox I get the following:

<html>
<head>
<title>
UCR - Houston Weekly Svc Report
</title>
<link REL="StyleSheet" TYPE="text/css"
HREF="http://scdadev.angelica.com/css/angelica.css">
</head>
<body>
<div class=main>
<table cellpadding=5 border=1 align=center>
<tr>
<td colspan=10 align=center>
<p><B> Houston Weekly Svc Report Summary</B></p>
<p>Requested by <B>Jay Santerre</B><BR>
From 01/25/2006 to 02/01/2006<BR>
As of 02-01-2006 09:44:22
</p></td>
</tr>
<tr>
<td class=header align=center>
Meter Serial Number
</td>
<td class=header align=center>
Meter Name
</td>
<td class=header align=center>
Meter Value
</td>
</tr>

</table>
<P><center><a class=body
href="http://scdadev.angelica.com/cgi-bin/p/reports?opr=JSANTERRE">Go
Back to Report Parameters</A></center><P>
</div>
</body>
</html>

Please advise. I have done a search to try and find the error of my
ways but have not found any one else with the issue I am having with a
solution.
 
J

John W. Kennedy

phillyfan said:
I have a script with the code below in it. It works fine in IE, I know
the statement has been stated many times before, but does not display
correctly in Firefox.

Code:

#!/usr/bin/perl -w

use strict;
use POSIX;
use diagnostics;
use CGI qw:)all);
use Fcntl qw:)flock);
use DBI;
[...]

print << "WEB_PAGE";

<html>
<head>
<title>
UCR - $svcname $periodtime $rptype Report
</title>
<link REL="StyleSheet" TYPE="text/css"
HREF="http://$servername/css/angelica.css">
</head>
<body>
<div class=main>
<table cellpadding=5 border=1 align=center>
<tr>
<td colspan=10 align=center>
<p><B> $svcname $periodtime $rptype Report Summary</B></p>
<p>Requested by <B>$svcnum[1] $svcnum[2]</B><BR>
From $todate to $fromdate<BR>
As of $asoftime
</p></td>
</tr>
<tr>
<td class=header align=center>
Meter Serial Number
</td>
<td class=header align=center>
Meter Name
</td>
<td class=header align=center>
Meter Value
</td>
</tr>

</table>
<P><center><a class=body
href="http://$servername/cgi-bin/p/reports?opr=$opr">Go Back to Report
Parameters</A></center><P>
</div>
</body>
</html>
WEB_PAGE

Looking at the page IN IE it displays the HTML page as I intended. In
Firefox I get the following:

<html>
<head>
<title>
UCR - Houston Weekly Svc Report
</title>
<link REL="StyleSheet" TYPE="text/css"
HREF="http://scdadev.angelica.com/css/angelica.css">
</head>
<body>
<div class=main>
<table cellpadding=5 border=1 align=center>
<tr>
<td colspan=10 align=center>
<p><B> Houston Weekly Svc Report Summary</B></p>
<p>Requested by <B>Jay Santerre</B><BR>
From 01/25/2006 to 02/01/2006<BR>
As of 02-01-2006 09:44:22
</p></td>
</tr>
<tr>
<td class=header align=center>
Meter Serial Number
</td>
<td class=header align=center>
Meter Name
</td>
<td class=header align=center>
Meter Value
</td>
</tr>

</table>
<P><center><a class=body
href="http://scdadev.angelica.com/cgi-bin/p/reports?opr=JSANTERRE">Go
Back to Report Parameters</A></center><P>
</div>
</body>
</html>

Please advise. I have done a search to try and find the error of my
ways but have not found any one else with the issue I am having with a
solution.

That's because (apparently) you're coding in a way that /requires/ one
of Microsoft's typical bugs to be present. The HTTP protocol requires a
"content-type" header line /saying/ that an HTML (or plain text, or
JPEG, or whatever) document follows. Microsoft, with their typical
arrogance, decided that, rather than follow the rules, they'd rather
poke around in the file to see what it looks like, and then guess.
(Hundreds of viruses have been written to take advantage of this wrong
and /stupid/ behavior.) As it happens, in your case, it is correctly
guessing that the file is HTML. But it isn't supposed to be guessing at all.

Firefox is doing what it's supposed to do.

Provide a proper HTTP header.

--
John W. Kennedy
"But now is a new thing which is very old--
that the rich make themselves richer and not poorer,
which is the true Gospel, for the poor's sake."
-- Charles Williams. "Judgement at Chelmsford"
 
J

Jürgen Exner

phillyfan said:
I have a script with the code below in it. It works fine in IE, I
know the statement has been stated many times before, but does not
display correctly in Firefox.

Then why don't you ask in a NG that actually deals with web browsers and
their differences?

jue
 
T

Tintin

phillyfan said:
I have a script with the code below in it. It works fine in IE, I know
the statement has been stated many times before, but does not display
correctly in Firefox.

Not a Perl issue.

Firefox just happens to adhere to HTTP/HTML standards, whereas IE breaks
them. If you output correct HTTP headers, firefox and any other compliant
browser will work just fine.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,183
Messages
2,570,966
Members
47,514
Latest member
AdeleGelle

Latest Threads

Top