This topic is locked
[SOLVED]

Redirect Internet Explorer

8/15/2021 8:48:43 PM
PHPRunner General questions
D
DRCR Dev author

Hi

I'm trying to redirect internet explorer in a code snippet. I've used the code below but it generates an error. is there anything I need to add to make this work?

if(using_ie())
{
header("Location: https://dfsdfsdfsdfsdfsdf.com/ie.html");
}
function using_ie()
{
$u_agent = $_SERVER['HTTP_USER_AGENT'];
$ub = False;
if(preg_match('/MSIE/i',$u_agent))
{
$ub = True;
}

return $ub;
}

-Cec

D
DRCR Dev author 8/16/2021

I got this code to work

if (strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') !== false) {
header('Location: /ie.html');
exit;
}
if (strpos($_SERVER['HTTP_USER_AGENT'], 'Trident') !== false) {
header('Location: /ie.html');
exit;
}