How To Detect IE Browser By PHP

How to write a PHP script to detect current user’s browser is IE or not

You can use PHP’s preg_match() to check if the current user’s browser is IE or not via “HTTP_USER_AGENT”

$useragent = htmlentities($_SERVER['HTTP_USER_AGENT'], ENT_QUOTES, 'UTF-8');
if (preg_match('~MSIE|Internet Explorer~i', $useragent ) || (strpos($useragent , 'Trident/7.0; rv:11.0') !== false)) {
	// do some for IE
}
0 0 votes
Article Rating
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments