CI_User_agent::is_mobile()

is_mobile([$key = NULL])

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

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

Return type:

bool

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

1
2
3
4
5
6
7
8
9
10
11
12
if ($this->agent->is_mobile('iphone'))
{
        $this->load->view('iphone/home');
}
elseif ($this->agent->is_mobile())
{
        $this->load->view('mobile/home');
}
else
{
        $this->load->view('web/home');
}
doc_CodeIgniter
2025-01-10 15:47:30
Comments
Leave a Comment

Please login to continue.