CoolBrew User Guide Version 1.3
Based on CodeIgniter Version 1.5.4


User Agent Module

This module gives you access to the Language class from your website documents. The User Agent Class provides functions that help identify information about the browser, mobile device, or robot visiting your site. In addition you can get referrer information as well as language and supported character-set information.

For more information about the methods accessed by these tags, please see the User Agent Class section of the CodeIgniter User Guide.

<?php get('core.user-agent.is_browser'); ?>

Returns TRUE/FALSE (boolean) if the user agent is a known web browser.

<?php get('core.user-agent.is_mobile'); ?>

Returns TRUE/FALSE (boolean) if the user agent is a known mobile device.

<?php get('core.user-agent.is_robot'); ?>

Returns TRUE/FALSE (boolean) if the user agent is a known robot. See the User Agent Class section of the CodeIgniter User Guide for more information about the list of known robots.

<?php get('core.user-agent.is_referral'); ?>

Returns TRUE/FALSE (boolean) if the user agent was referred from another site.

<?php get('core.user-agent.browser'); ?>

Returns a string containing the name of the web browser viewing your site.

<?php get('core.user-agent.version'); ?>

Returns a string containing the version number of the web browser viewing your site.

<?php get('core.user-agent.mobile'); ?>

Returns a string containing the name of the mobile device viewing your site.

<?php get('core.user-agent.robot'); ?>

Returns a string containing the name of the robot viewing your site.

<?php get('core.user-agent.platform'); ?>

Returns a string containing the platform viewing your site (Linux, Windows, OS X, etc.).

<?php get('core.user-agent.referrer'); ?>

The referrer, if the user agent was referred from another site.

<?php get('core.user-agent.agent_string'); ?>

Returns a string containing the full user agent string. Typically it will be something like this:

Mozilla/5.0 (Macintosh; U; Intel Mac OS X; en-US; rv:1.8.0.4) Gecko/20060613 Camino/1.0.2

<?php get('core.user-agent.accept_lang', 'lang'); ?>

Lets you determine if the user agent accepts a particular language. Example:

if (get('core.user-agent.accept_lang', 'en'))
{
    echo 'You accept English!';
}

Note: This function is not typically very reliable since some browsers do not provide language info, and even among those that do, it is not always accurate.

<?php get('core.user-agent.accept_charset', 'charset'); ?>

Lets you determine if the user agent accepts a particular language. Example:

if (get('core.user-agent.accept_charset', 'utf-8'))
{
    echo 'You browser supports UTF-8!';
}

Note: This function is not typically very reliable since some browsers do not provide character-set info, and even among those that do, it is not always accurate.