CI_User_agent::is_browser()

is_browser([$key = NULL])

Parameters:
  • $key (string) – Optional browser name
Returns:

TRUE if the user agent is a (specified) browser, FALSE if not

Return type:

bool

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

if ($this->agent->is_browser('Safari'))
{
        echo 'You are using Safari.';
}
elseif ($this->agent->is_browser())
{
        echo 'You are using a browser.';
}

Note

The string “Safari” in this example is an array key in the list of browser definitions. You can find this list in application/config/user_agents.php if you want to add new browsers or change the stings.

doc_CodeIgniter
2016-10-15 16:32:04
Comments
Leave a Comment

Please login to continue.