Office Address

41/D, West Brahmondi, Narsingdi

Phone Number

+880-1975374887

Email Address

dynamicweblab@gmail.com

You can easily detect browser using this function and add visitor browser name in the body class function .

Put this on your theme functions.php

[php] add_filter(‘body_class’,’myfunction_browser_body_class’);
function myfunction_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_browser’;

if($is_iphone) $classes[] = ‘iphone’;
return $classes;
}
[/php]

The sample output may like this

[php]<body class="home logged-in ie">[/php]

Source: Snipplr.com

Written by

Maidul Islam

I am a freelance web developer.Like to share what i learn.