CodeIgniter Forums
User agent is_mobile function always returns true - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5)
+--- Forum: General Help (https://forum.codeigniter.com/forumdisplay.php?fid=24)
+--- Thread: User agent is_mobile function always returns true (/showthread.php?tid=246)



User agent is_mobile function always returns true - future_man - 11-14-2014

Does anyone know what could be causing this? Everytime I want to find out if a device is a mobile device or not I get a big fat YES from the codeigniters is_mobile function!

I do $this->agent->is_mobile() and on my desktop I get true. I write $this->agent->mobile() and I get "Windows Phone"... Even though I am using win7 OS on a desktop computer. It seems function detects windows and thinks I am using windows phone.

From the user_agents.php:
PHP Code:
// Phones and Manufacturers 
'windows' => "Windows Phone" 



RE: User agent is_mobile function always returns true - Chroma - 11-14-2014

I know this is cheating, but when I was wanting to use the user agent data with CI 2.2.0, it was so out of date, I went to the CI 3 github repository and copied the code out.

Be careful not to copy all the definitions as a single file, but to take it block by block as they are different.

I hope this helps.