Skip to main content

Browser Class by Bluesman

A friend of mine and colleague Goran Pilipović (also known as Bluesman in developers community) recently sent me his own version of mine Browser Detection class.

Practically speaking, it is completely new code, because compared to my rather simple class this one has bigger number of methods. Here is an example with usage:

require_once "class.Browser.php";

Browser::get();

echo "<pre>";
echo "<br />User Agent:      ".Browser::ua();
echo "<br />Browser Id:      ".Browser::id();
echo "<br />Browser Name:    ".Browser::name();
echo "<br />Browser Version: ".Browser::version();
echo "<br />OS:              ".Browser::os();
echo "<br />Device:          ".Browser::device();
echo "<br />Platform:        ".Browser::platform();
echo "<br />Is PC:           ".yesno(Browser::isPc());
echo "<br />Is Windows:      ".yesno(Browser::isWindows());
echo "<br />Is Mac:          ".yesno(Browser::isMac());
echo "<br />Is Linux:        ".yesno(Browser::isLinux());
echo "<br />Is Symbian:      ".yesno(Browser::isSymbian());
echo "<br />Is IE:           ".yesno(Browser::isIe());
echo "<br />Is Safari:       ".yesno(Browser::isSafari());
echo "<br />Is Firefox:      ".yesno(Browser::isFirefox());
echo "<br />Is Chrome:       ".yesno(Browser::isChrome());
echo "<br />Is Opera:        ".yesno(Browser::isOpera());
echo "<br />Is iPhone:       ".yesno(Browser::isIphone());
echo "<br />Is Handlheld:    ".yesno(Browser::isHandheld());
echo "<br />Is Phone:        ".yesno(Browser::isPhone());
echo "<br />Is Console:      ".yesno(Browser::isConsole());
echo "<br />Is Terminal:     ".yesno(Browser::isTerminal());
echo "</pre>";

Class file as well as example file you can download here. In case you figure out any problem or bug please leave your comment with bug description here.