Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

I can't get the very basic "Location" command to redirect the browser if using IE6. This code works for all other browsers, and I'm wondering if there is some trick for IE6. I use the command like so:
print "Location: http://xxx.com/somescript.cgi?p1=x1&p2=x2&etc\n\n"; exit(0);
and I do not print out any other headers at all. Any insight you can provide will be greatly appreciated!

Replies are listed 'Best First'.
Re: Location and IE6
by tachyon (Chancellor) on May 08, 2002 at 13:28 UTC

    You should probably drop a stronger hint with a header like:

    print "HTTP/1.0 302 Moved Status: 302 Moved Location: http://www.wherever.com\n\n";

    When you print a very basic header the server software adds all the other bits you left off using a "best guess" so presumably its best guess is not good enough for IE6. Failing that send a redirect page like:

    print "Content-type: text/html <html> <head> <title>Redirect</title> <meta http-equiv="refresh" content="0; url=http://www.wherever.com"> </head> <body></body> </html>";

    cheers

    tachyon

    s&&rsenoyhcatreve&&&s&n.+t&"$'$`$\"$\&"&ee&&y&srve&&d&&print

Re: Location and IE6
by perlplexer (Hermit) on May 08, 2002 at 12:45 UTC
      This doesn't work either. In both cases the browser just hangs forever.
        I don't have IE6 to test this; however, This test by hopes suggests that the problem is elsewhere.
        Cut & paste his example, see if that works.

        --perlplexer
Re: Location and IE6
by hopes (Friar) on May 08, 2002 at 12:54 UTC
    Try using CGI:
    #!/usr/bin/perl use CGI; $query=new CGI; print $query->redirect(-uri=>'http://www.yoursite.com', -nph=>1);

    In my IE6 works...

    Hopes
    $_=$,=q,\,@4O,,s,^$,$\,,s,s,^,b9,s, $_^=q,$\^-]!,,print