Set Cookie then route to other page ?

Hi ! I'm using Perl, to set a cookie. After setting the cookie I want to route to another page but this doesn't work because the Browser interprets Location: http://www.anyserver... as text. Any idea which works with ANY Browser ?

regards
ItsMe
ItsMeAsked:
Who is Participating?
 
fibdevConnect With a Mentor Commented:
This is easy!  :)
Put this in your cgi script ...

#!/usr/bin/perl
#
print "Content-type:text/html\n";
print "Refresh:3; # change this number for how many seconds to wait. URL=http://www.yoursite.com/newpage.htm\n\n";

#  (handle form stuff or whatever you want your CGI to do here ie: set the cookie)

# then print the redirect for old browsers, with META tag:

print <<EndHTML;
<html><head>
<title>Working ...</title>
</head>
<body>
The page you have requested have been moved<a href="http://www.yoursite.com/newpage.htm/">here</a>.<p>
</body>
</html>
EndHTML
0
 
ItsMeAuthor Commented:
I thougt of this, too. Does all Browsers support this Meta Tah (even MS-DOS Browsers) ? If, it would be enough to use the META tag ...
0
 
fibdevCommented:
This method will work on ns and ie 3x and up browsers.  I don't know about other browsers, but with the link, it will give you something to fall back on.
0
 
fibdevCommented:
you could place javascript into the the heading of the page, but even then, the older browsers won't support it.
0
 
ItsMeAuthor Commented:
Thanks :-)
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.