30.10.2005
Browser Detection
I needed a simple PHP class that detect browser and OS based on user agent string. I’ve tried some free available classes on net like PEAR::Net_UserAgent_Detect, but none worked for me. They were either too big or didn’t worked well with most recent browsers (like Opera 8.5 or Netscape 8).
After I spent some time by looking to code that suit my needs, I’ve decided to write my own class which should be working fine with most recent browsers. It recognize most popular browsers (like IE, Firefox, Opera …) as well as it’s version and subversion number (like Opera 8.50, Firefox 1.0.6, etc.). I didn’t care to add support for ancient and no longer used browsers like Netscape 4.x etc.
Here is the class code. You can use it in your projects for free as long as you don’t change header information.
