Can we create a thorough question/answers post with the core methods that allow browser detection in Joomla 2.5 and 3 ? After a quick research in the web, I feel that there is not sufficient information on a single page the fulfills the topic.
A more thorough walk through should really be added to the docs wiki IMO, but sharing what I can via mobile now.
For 2.5 and 3.x compatibility, you can use JBrowser to do some browser detection. However, this class may not work well with newer browsers or versions. To use it to get the browser:
$browser = JBrowser::getInstance()->getBrowser();
For 3.2 and newer, you can use JApplicationWebClient, which is a newer class designed to be more flexible with today's browser options. To use it to get the browser:
$client = JFactory::getApplication()->client->browser;
Both classes are documented on the API site, http://api.joomla.org/cms-3/index.html will link you to the base page for 3.3 docs.
In addition to Michael's answer, the JApplicationWebClient Class has a few other useful properties:
$client = JFactory::getApplication()->client; $client->browser; // The detected browser used by the web client (returns an integer) $client->browserVersion; // The detected browser version used by the web client. (string) $client->mobile; // True if the web client is a mobile device (Boolean) $client->platform; // The detected platform on which the web client runs (integer) $client->userAgent; //The web client's user agent string. (string) $client->robot; // True if the web client is a robot (Boolean)