<?php
echo $_SERVER['HTTP_USER_AGENT'];exit;
preg_match('/MSIE (.*?);/', $_SERVER['HTTP_USER_AGENT'], $matches);
if(count($matches)<2){
preg_match('/Trident\/\d{1,2}.\d{1,2}; rv:([0-9]*)/', $_SERVER['HTTP_USER_AGENT'], $matches);
}
if (count($matches)>1){
//Then we're using IE
$version = $matches[1];
switch(true){
case ($version<=8):
//IE 8 or under!
echo '8';
break;
case ($version==9 || $version==10):
//IE9 & IE10!
echo '9-10';
break;
case ($version==11):
//Version 11!
echo '11';
break;
default:
echo $version;
//You get the idea
}
}
No comments:
Post a Comment