You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I’m using CI UA library but if I navigate trough a BB device or a Android, I get always “Safari” as result. This is my code:
$this->load->library('user_agent');
if ($this->agent->is_browser()) {
$device = $this->agent->browser();
} elseif ($this->agent->is_mobile()) {
$device = $this->agent->mobile();
} else {
$device = "";
}
I test the UA returned by my browser and get this:
Mozilla/5.0 (X11; Linux i686; rv:12.0) Gecko/20100101 Firefox/12.0
And from my BB get this:
Mozilla/5.0 (Blackberry U;Blackberry 9300;en) AppleWebKit/534.8+ (KHTML, like Gecko) Version/6.00.668 Mobile Safari/534.8+
But UA class still saying for BB that it's Safari when is not.
The entire thread is here: http://codeigniter.com/forums/viewthread/217014/
The text was updated successfully, but these errors were encountered:
Your logic is wrong ... Just because you're accessing the page from a mobile device, it doesn't mean that you're not using a browser. It's natural that is_browser() returns TRUE and since you're using elseif, your application never gets to the is_mobile() check, which works fine by itself.
I’m using CI UA library but if I navigate trough a BB device or a Android, I get always “Safari” as result. This is my code:
$this->load->library('user_agent');
if ($this->agent->is_browser()) {
$device = $this->agent->browser();
} elseif ($this->agent->is_mobile()) {
$device = $this->agent->mobile();
} else {
$device = "";
}
I test the UA returned by my browser and get this:
Mozilla/5.0 (X11; Linux i686; rv:12.0) Gecko/20100101 Firefox/12.0
And from my BB get this:
Mozilla/5.0 (Blackberry U;Blackberry 9300;en) AppleWebKit/534.8+ (KHTML, like Gecko) Version/6.00.668 Mobile Safari/534.8+
But UA class still saying for BB that it's Safari when is not.
The entire thread is here: http://codeigniter.com/forums/viewthread/217014/
The text was updated successfully, but these errors were encountered: