Re: CGI scripts and MSIE
- From: Stephen Patterson <steve@xxxxxxxxxxxxxx>
- Date: Thu, 24 May 2007 18:51:56 GMT
On Thu, 24 May 2007 10:28:20 +0100, Nigel Wade wrote:
Geoffrey Clements wrote:
I'm having fun setting up my home server for the web and other things -I would guess that you haven't specified in the HTML what the contents
it's been a great learning experience but I've now got a problem that
seems to affect IE only:
Last night I put a perl script into my cgi-bin directory and gave it
some testing by connecting from my desktop using both konq and firefox,
everything seems to be fine. At work this morning I thought I'd take a
quick look with MSIE and, well, you can probably guess ... it doesn't
work.
The file name is xxx.pl (actually it's not but you get my drift). With
MSIE it pops up a dialog asking if I want to save or open xxx.pl. When
I save and look at the contents it is the HTML output generated by
xxx.pl. Is there a (standard) way to deal with this at the server end?
My server is Debian Etch and my web-server is lighttpd.
I ask this question because I'm still quite a novice at this sort of
thing and googling hasn't turned up anything useful yet.
are. Most likely the other browsers have defaulted to text/html, or have
a defined action for extension .pl. IE has not defaulted to text/html
and has no action for .pl. So it has fallen back to the [safe] position
of not interpreting the contents at all, and instead allowing you to
save them.
What you need to do is add a header to the HTML you send back saying
what the contents are. If it is HTML add the header "Content-type:
text/html" to your output. It's better to use the Perl CGI modules, for
example:
require "cgi-lib.pl";
print &PrintHeader;
or
use CGI qw(:standard);
print header;
will do what you require.
For reference, although header defaults to setting
"Content-type: text/html\n\n" it will also take the content type as an
argument, so print header('text/html') is valid
--
Stephen Patterson :: steve@xxxxxxxxxxxxxx :: http://patter.mine.nu/
GPG: B416F0DE :: Jabber: patter@xxxxxxxxxxxxxxx
"Don't be silly, Minnie. Who'd be walking round these cliffs with a gas
oven?"
.
- Follow-Ups:
- Re: CGI scripts and MSIE
- From: Geoffrey Clements
- Re: CGI scripts and MSIE
- References:
- CGI scripts and MSIE
- From: Geoffrey Clements
- Re: CGI scripts and MSIE
- From: Nigel Wade
- CGI scripts and MSIE
- Prev by Date: Re: CGI scripts and MSIE
- Next by Date: Re: CGI scripts and MSIE
- Previous by thread: Re: CGI scripts and MSIE
- Next by thread: Re: CGI scripts and MSIE
- Index(es):
Relevant Pages
|