Zend Certified Engineer

phpguru.org

Free PHP, Javascript and C# code

Browser Detection

If you ever wanted some browser detecion code, here it is. It works along the same lines as the Ultimate Javascript Client Side Detector, however it's server side. It doesn't pollute the global namespace, and it's very simple. Just include the code and call the function. Easy.

require_once('UserAgent.php');

$browser = GetUserAgent();

What does it detect? Well, Internet Explorer versions 4 thru 7, Firefox one and two, Netscape Navigator 2 to 8, Opera 5 to 9, Konqueror, Windows (98, NT, XP, 2003, Vista), Macintosh (OS X), Linux ( *nix technically) and a few of the more common robots (eg. Google).

If you want to help out, simply visit this page which logs your browsers useragent string, and fill out the information. Cheers.

Download

Link to me

If you use any of the code on this site (and if you don't I guess) or it makes your life easier, I'd appreciate a link - http://www.phpguru.org. Thanks.

Last modified: 12:11 18th January 2007