elxisBrowserHelper

Last update by Elxis Team

Get information about the visitor browser

The elxisBrowserHelper class is an Elxis Helper that returns information about the visitor's browser. You can provide as input to the helper a user agent string or you can let it detect it.

As all Elxis helpers, the browser helper is accessible via the obj method of the elxisFramework class.

eFactory::getElxis()->obj('browser')

To get the browser information:

<?php
//detect user agent
$browser_info = $elxis->obj('browser')->getBrowser();
//or provide a custom user agent to check:
$browser_info = $elxis->obj('browser')->getBrowser($user_agent);
?>

The returned $browser_info is an array having the following elements.

  • agent The user agent string
  • browser The browser name (eg. Firefox)
  • version The browser's version (eg. 4.0.1)
  • platform The general name of the operating system. Windows, Linux, Mac, etc
  • os Operating system short name (eg. nt)
  • os_version Operating system version (eg. 6)
  • os_name User friendly Operating system name (eg. Windows Vista)
  • mobile True if it is a mobile device, else false
  • robot True if it is a web crawler like google, else false
  • aol True if it is an AOL (America Online) browser, else false
  • aol_version The AOL browser version (if it is an AOL browser)

It has been read 4113 times
elxisIPHelper
Previous article
elxisIPHelper

You are free to copy, distribute and transmit the articles in this site for non-commercial purposes.
Creative Commons 3.0