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;
} else {
    print "Location: $url2\n\n";
}






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

Reply via email to