A Set of functions to tell what type of browser a surfer is using
<? function inAgent($agent) { $notAgent = strpos($_SERVER['HTTP_USER_AGENT'],$agent) === false; return !$notAgent; } function isIE() { if (inAgent('MSIE') && !isOpera()) { return true; } return false; } function isSafari() { $br = new Browser; if ($br->Platform == "MacIntosh"||inAgent('Safari')) { return true; } return false; } function isFF() { if (inAgent('Firefox')) { return true; } return false; } function isNS4() { if ((!inAgent('MSIE')) && (inAgent('Mozilla/4'))) { return true; } return false; } function isIE7() { if (inAgent('MSIE 7') && !inAgent('Opera')) { return true; } return false; } function isOpera() { if (inAgent('Opera')) { return true; } return false; } ?>
Pretty self explanatory, include the functions then use isIE, isSafari, isFF, etc..
Comments
Add your comment