philbrom
asked on
Redirecting a user
Hello,
I would like, depending on their browser version, to redirect users to another URL (say, if their browser won't support layers,...). Anybody can help?
For info, here's the script I have so far written.
<html>
<head>
<title>Test?</title>
<?php
$r=$HTTP_USER_AGENT;
$regexp="Mozilla/4";
if (ereg($regexp, $r, $reg)) echo "Good!!<p>";
elseif (!ereg($regexp, $r, $reg))
{
Header("Location: http://www.php.net");
}
?>
</head>
<body>
The browser you use is <?php echo $HTTP_USER_AGENT; ?>
</body>
</html>
Why won't it work
I would like, depending on their browser version, to redirect users to another URL (say, if their browser won't support layers,...). Anybody can help?
For info, here's the script I have so far written.
<html>
<head>
<title>Test?</title>
<?php
$r=$HTTP_USER_AGENT;
$regexp="Mozilla/4";
if (ereg($regexp, $r, $reg)) echo "Good!!<p>";
elseif (!ereg($regexp, $r, $reg))
{
Header("Location: http://www.php.net");
}
?>
</head>
<body>
The browser you use is <?php echo $HTTP_USER_AGENT; ?>
</body>
</html>
Why won't it work
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Use javascript I think it will help you if you want I will provide you code
Harry
Harry
Did you read my comment harwantgrewal?
:o\
Ant
:o\
Ant
I honestly think you should do this on the client side - use Javascript.
What browsers do you need to test for and hence redirect to different pages? If you provide the necessary information I can put the javascript together for you.
:o)
Ant