If you tired of having nasty little conditional comments like this “<!–[if lte IE 6]>…<![endif]–>” in your clean markup. Here is a quick and simple PHP function for checking what version of explorer your visitor has.
function isIE($version) {
if ( preg_match('/MSIE (6|7)\.0/', $_SERVER['HTTP_USER_AGENT'], $ver) ) {
if ($ver[1] == $version) return true;
} else {
return false;
}
}
And here is how you use it:
<?php if (isIE(6)): ?> <link href="ie6.css" rel="stylesheet" type="text/css" media="screen" /> <?php endif ?>
Simply change the number to test for IE7! Now your markup doesnt have those nasty hack comment/conditional statements and you can sleep easy at night.
1 comment so far
[...] can read the rest of this blog post by going to the original source, here [...]