PHP script to check if user agent msie

Dragan Eror's picture
in

With this php script you can easy check if user agent is internet explorer

  1. $ua = $_SERVER['HTTP_USER_AGENT'];
  2. if (strpos($ua,'MSIE') != false && strpos($ua,'Opera') === false) {
  3.     if (strpos($ua,'Windows NT 5.2') != false) {
  4.         if(strpos($ua,'.NET CLR') === false) return;
  5.     }  
  6.     $ie6 = isset($_GET['ie6']) ? $_GET['ie6'] : '';
  7.     if ((substr($ua,strpos($ua,'MSIE')+5,1) < 7) && $ie6 != true) {
  8.         header("Location: ie.html");
  9.     }
  10. }

Comments

Anonymous's picture
[ close ]
Help Upgrade the Web: Download Firefox 3.6