Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

It only displays text in Netscape 1

Status
Not open for further replies.

makuk

Technical User
Apr 16, 2003
10
GB
Hi

My script works perfectly well in Opera and Explorer but when run in Netscape it just displays the pages source text on the screen.

I have tried everything I know to do including:

deleting and re-uploading files
renaming .cgi to .pl
and beating my dog

Please if anyone could help it would be greatly appreciated.

Thanks

Mark.
 
I sorted it thanks.

Even though none of you knew what it was. Argh, see you're not that good are you. Had you all stumped.

LOL
 
You may yes.

This line appears:

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

And as I only test in IE I removed Content-type: text/html
leaving:

print "\n\n";

Unfortunately as Netscape is soooooo thick it needs this line to display the html.

YOU ASK: Why did you remove this.
ANSWER: because the words Content-type: text/html appear in my page and I don't want them there, so I removed them.

Unfortunately, as above, netscape doesn't like that.

So... I got it working in netscape as well now but I have that horrible text on my screen. So, I just gotta work out how to sort that out now.

Unfortunately, I have only played with PERL for 2 weeks and I don't really have a clue what I am doing. !!

So, if anyone knows how to remove that line and it still displaying in Netscape it would be a great help.

Cya

Makuk
 
<META content='text/html; charset=iso-8859-1'
?????????????
 
print &quot;<HTML><HEAD><TITLE>Your page</TITLE><META content='text/html; charset=iso-8859-1' http-equiv=Content-Type><META content='MSHTML 5.00.2920.0' name=GENERATOR></HEAD><BODY aLink=#000000 bgColor=#000000 link=#c0c0c0 text=#ffffff vLink=#ffff00 background='background.jpg'>
 
It is used in this context:

# Print the HTML header
sub print_header {
print &quot;Content-type: text/html\n\n&quot;;
open (HEADER,&quot;$basepath/$header&quot;) || print &quot;Could not open $basepath/$header $! \n&quot;;
while (<HEADER>) {
print $_;
}
close(HEADER);

Any ideas what I would do here please.

Thanks

Makuk
 
My best guess becuze I am not fully understanding is
to use something like
print qq!
or

#!/usr/bin/perl

print &quot;Content-type: text/html\n\n&quot;;

print &quot;<HTML><HEAD><TITLE>Users Online Now</TITLE><META content='text/html; charset=iso-8859-1' http-equiv=Content-Type><META content='MSHTML 5.00.2920.0' name=GENERATOR></HEAD><BODY aLink=#000000 bgColor=#000000 link=#c0c0c0 text=#ffffff vLink=#ffff00 background='back.jpg'><CENTER><IMG src=' border=0 height=80 src=' width=366><br>\n&quot;;
is how I do it
 
#######################################################################
sub PrintKop {
open(HEAD,&quot;my.head&quot;) || die print &quot;$MESS{'IO_ERROR'} (my.head)&quot;;
foreach (<HEAD>) { print $_ }
close (HEAD);
}

#######################################################################
sub PrintStaart {
open(HEAD,&quot;my.foot&quot;) || die print &quot;$MESS{'IO_ERROR'} (my.foot)&quot;;
foreach (<HEAD>) { print $_ }
close (HEAD);
}

#######################################################################
my.head would be
sub print_header {
print &quot;Content-type: text/html\n\n&quot;;
open (HEADER,&quot;$basepath/$header&quot;) || print &quot;Could not open $basepath/$header $! \n&quot;;
while (<HEADER>) {
print $_;
}
close(HEADER);



 
There are some simple examples of CGI stuff in the faqs section of the CGI forum.

Code:
#!/usr/local/perl
print &quot;Content-type: text/html\n\n&quot;;
print &quot;<html><head><title>simplest cgi</title>
    </head>
    <body><p>This works in any browser</p>
    </body></html>&quot;;

That should work in just about any browser. If you are seeing the 'content-type' line in a browser, you are probably printing it twice or you are printing something else first.
'hope this helps

If you are new to Tek-Tips, please use descriptive titles, check the FAQs, and beware the evil typo.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top