----- Original Message ----- 
From: "zentara" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, August 21, 2002 9:14 PM
Subject: Re: browser redirect


> On Tue, 20 Aug 2002 15:25:41 -0700 (PDT), [EMAIL PROTECTED] (Dave
> Smith) wrote:
> 
> >I'm trying to write a program that will redirect people looking at a
> >site using Netscape 4.  (I have a header that looks good in Mozilla,
> >Netscape 6, and IE, but looks pretty crappy in Netscape 4). 
> >
> >I'm new at programming, and am still reading Elements of Programming
> >with Perl, so please go easy on me.
> >
> >I've tried this, thinking the regex would look for Netscape 4, and
> >redirect but I'm missing something.  It's not working. 
> 
> Don't print the "Content-type: text/html\n\n" when using Location.
> 
> #!/usr/local/bin/perl
> 
> $url1 = 'http://myserver.com/cgi-bin/surly.cgi';
> $url2 = 'http://myserver.com/cgi-bin/tipsy.cgi';
> 
> if ($ENV{'HTTP_USER_AGENT'} =~ /Mozilla 4/
>     and not $ENV{'HTTP_USER_AGENT'} =~ /compatible/i ) {
>     print "Location: $url1\n\n;

Missed the quote =)

> } else {
>     print "Location: $url2\n\n";
> }
> 
> 

Not really, my sample code was "...text/html\n"; 
The header not finished yet. Then, "Location: ....\n\n"; 
The header finished.

And on my server or browser, if I missed "Content-type...", 
the browser will treat this as a file download operation, 
and prompted if I would like to download the script. 

Anyway, for my concept, there is no reason to skip the content-type 
header and I believe there is no harm all the time, to add the 
content-type header 
.. =)

Rgds,
Connie


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to