[Techtalk] http refresh?

Almut Behrens almut-behrens at gmx.net
Sat Feb 5 04:40:17 EST 2005


On Fri, Feb 04, 2005 at 10:43:50AM +0000, Caroline Johnston wrote:
> Hi list,
> 
> I'm trying to use an <http-equiv content="Refresh"> tag to refresh a page 
> to a new location defined at runtime in a (perl) cgi script. I'm making 
> the tag like this:
> 
> my $tag = '<meta http-equiv="Refresh"  content="1;'
>           . $self->{q}->url
>           .'?submit=login;p=login;_cookiecheck=1"/>'
> 
> and sticking it the header.
> 
> This works as expected under firefox but ignores the parameters in IE. Do 
> I need to escape the ? somehow? What is firefox doing that IE isn't? 

Do you have the string "url=" in front of the URL?
(yes, it's not in the above code, but, theoretically, it could be
returned by $self->{q}->url together with the URL...)

AFAIK, you don't need to escape the ? -- or & for that matter [1].
(BTW, shouldn't those semicolons in the paramterlist be ampersands?)

I just played around without the "url=", trying to redirect to some
parameterized google search:  It sent IE (6.0) into an endless loop,
constantly reloading the same original page (which could only be
stopped by closing the application ;)  while Firefox did not have
any problems with it.
Whether the latter behaviour is the proper way to handle incorrect
input, is another question, though... (in the larger context of things)

Cheers,
Almut


[1] of course, you need to escape those special chars, if they're part
of some parameter itself, e.g. if you're doing a "double redirect".
I occasionally had the need to include a complete URL?params as a
parameter, for example when redirecting to some generic login page,
which - upon successful login - is supposed to redirect back to the
page the user came from - something like

  http://host.domain.com/login?user=abc&camefrom=...

where the "..." is a full URL with a parameter list -- in the second
URL you need to escape special chars (with %XX hex values)



More information about the Techtalk mailing list