WebResourcesDepot

Posted by | Posted on 13:35

WebResourcesDepot


Browser Detection With PHP – Browser.php

Posted: 06 Jan 2011 12:42 AM PST

Learning a user's browser and its version is usually very important to decide if any other scripts or styles need to be inserted into the web page.

And, such tasks are usually accomplished with JavaScript as we don't need to go so deep (detecting if it is IE or not is generally enough).

Browser.php

Browser.php is a very useful PHP class that helps collecting data about a visitor's browser including:

  • platform used
  • browser
  • browser version

It can detect almost every popular browser including mobile + tablet devices and robots with a few lines just like:

 $browser = new Browser(); if( $browser->getBrowser() == Browser::BROWSER_FIREFOX && $browser->getVersion() >= 2 ) { 	echo 'You have FireFox version 2 or greater'; } 

If the need for browser detection is more than just analyzing whether it is IE, Firefox, Chrome or Safari, then Browser.php is definitely a must-bookmark.

Special Downloads:
Ajaxed Add-To-Basket Scenarios With jQuery And PHP
Free Admin Template For Web Applications
jQuery Dynamic Drag’n Drop
ScheduledTweets

Advertisements:
Professional XHTML Admin Template ($15 Discount With The Code: WRD.)
Psd to Xhtml
SSLmatic – Cheap SSL Certificates (from $19.99/year)

Comments (0)

Post a Comment