12/13/2016 - 11:44 AM

Detect Browser

Detect Browser

//* Do NOT include the opening php tag shown above. Copy the code shown below.

If you want to use a different stylesheet for different browsers you can use HTML conditional tags or you can use this. 

function browser_body_class($classes) {
  global $is_lynx, $is_gecko, $is_IE, $is_opera, $is_NS4, $is_safari, $is_chrome, $is_iphone;

  if($is_lynx) $classes[] = 'lynx'; 
  elseif($is_gecko) $classes[] = 'gecko'; 
  elseif($is_opera) $classes[] = 'opera'; 
  elseif($is_NS4) $classes[] = 'ns4'; 
  elseif($is_safari) $classes[] = 'safari'; 
  elseif($is_chrome) $classes[] = 'chrome'; 
  elseif($is_IE) $classes[] = 'ie'; 
  else $classes[] = 'unknown'; 
  if($is_iphone) $classes[] = 'iphone'; 
  return $classes;