CodeIgniter Forums
Better User Agent for Code Igniter ? - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: Better User Agent for Code Igniter ? (/showthread.php?tid=51608)

Pages: 1 2


Better User Agent for Code Igniter ? - El Forum - 05-10-2012

[eluser]ReyPM[/eluser]
Hi:
Does any knows if exists any better User Agent class for CI? I'm using the shipped with CI but if I navigate trough a BB device or a Android, I get always "Safari" as result. This is my code:

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 = "";
          }

Any help?


Better User Agent for Code Igniter ? - El Forum - 05-10-2012

[eluser]CroNiX[/eluser]
Much has changed with this since v2 was released 2 years ago in the github repo.


Better User Agent for Code Igniter ? - El Forum - 05-10-2012

[eluser]ReyPM[/eluser]
And where I can found does changes?


Better User Agent for Code Igniter ? - El Forum - 05-10-2012

[eluser]CroNiX[/eluser]
You should probably download the whole package as the changes to that class might rely on other changes elsewhere. First though, you could try just getting the user agent definitions and replace it in your current version.
https://github.com/EllisLab/CodeIgniter/blob/develop/application/config/user_agents.php


Better User Agent for Code Igniter ? - El Forum - 05-10-2012

[eluser]ReyPM[/eluser]
Not works, test both first change the content of config/user_agents.php and then change the complete library and still saying send trough Safari when I send from my BB and of course using the browser at my BB but I test from Android ang get the same result


Better User Agent for Code Igniter ? - El Forum - 05-10-2012

[eluser]CroNiX[/eluser]
Then you'll probably have to figure out the proper entries to add to user_agents.php to detect android. Could also be just your particular device and not all "android" platforms. Maybe something changed your user agent string? Did you look at your agent string?


Better User Agent for Code Igniter ? - El Forum - 05-10-2012

[eluser]WanWizard[/eluser]
Go to http://user-agent-string.info (and click on "analyze my UA") to see exactly what your browser reports...


Better User Agent for Code Igniter ? - El Forum - 05-10-2012

[eluser]ReyPM[/eluser]
[quote author="WanWizard" date="1336684079"]Go to http://browsers.garykeith.com (and click on "your browser") to see exactly what your browser reports...[/quote]

Jejeje none is reported just a
Quote:403.8 Tools Abuse Detected
is showed


Better User Agent for Code Igniter ? - El Forum - 05-10-2012

[eluser]WanWizard[/eluser]
Updated the link to a better tool...


Better User Agent for Code Igniter ? - El Forum - 05-10-2012

[eluser]CroNiX[/eluser]
echo $_SERVER['HTTP_USER_AGENT'];