why does browser prompt to download?

liunx

Guest
I now have another problem with my cgi, here is the source:

#!/usr/bin/perl

#use # to comment
%pages = ( matt => "http://www.matthewdonovan.co.uk", grant => "http://www.grantdonovan.co.uk", HTMLFORUMS => "http://www.htmlforums.com");
print "Content-type:text/html\n\n";

print <<EndHdr;
<html><head><title>URL list</title></head>

<body bgcolor="000066" link="#ffffff" vlink="#fffff">
<font face="arial" color="orange"><br>
URL list:
<br>
<br>
EndHdr

foreach $key (keys %pages) {
print "<li><a href=http://www.htmlforums.com/archive/index.php/\"$pages{$key}\">$key</a>\n";
}

print "</font> </body> </html>";


The script that can be found here: <!-- m --><a class="postlink" href="http://www.matthewdonovan.co.uk/cgi-bin/url_list.cgi">http://www.matthewdonovan.co.uk/cgi-bin/url_list.cgi</a><!-- m -->

I thought that the cgi would display as webpage when you go to it. but instead my browser prompts to Download the file instead of diplaying it in the window. Does anyone know why this is?

I have tried embedding it into a .shtml file using the

<!--#exec cgi="/cgi-bin/url_list.cgi" -->

command and that works fine. but really i want to go straight to the cgi, is this possible?

thanks in advance

Matt Dhmmm....I thought I already said this but I'll give it another try....

this line:

print "Content-type:test\n\n";

should be:

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

give that a try and see if it doesn't help.

Regards,
KevinAlso.....I'm not sure but when I copy and pasted your code into a editor I noticed there is a space after EndHdr

Make sure there is no space on the end of that line.

After changing the content type line and removing the space on the end of the line I mentioned above the script runs fine on my Linux server.

Regards,
KevinSorry about that Kevin. I didn't realise what you meant first time round saying that 'test' should be 'text', i understand now.

I suddenly realised what you meant, then tried to alter this post but you replied just beforehand.

I also think that i make a mistake earlier and uploaded in binary not ascii. doh!

Everything seems to working now.

Thanks for you all you help!

Matt D:D :D :D :D

Kevin
 
Top