Welcome Guest, Not a member yet? Register   Sign In
Detect in app browser by user agent library
#1

Hello everyone,

I found following information about detecting in-app browser detection and wondered if it's possible to identify that information also by the user agent library?

https://stackoverflow.com/questions/1638...javascript

Thanks in advance
Reply
#2

(This post was last modified: 11-27-2017, 01:06 PM by BABYpanda. Edit Reason: grammar )

This is not possible within the libraries CI provides. You can however create your own library to extend the default user agent library of CI. This should be relatively easy as it apparently requires a short amount of additional code.

In case of an Android application you need to know the exact applications' package name, which is pretty much a pain unless you want to detect a specific application (as far as I'm concerned).
Reply
#3

Unfortunately the $_SERVER['HTTP_X_REQUESTED_WITH'] is not an official PHP variable, but I managed to find some difference between the regular user agent string and the user agent string from an app.

Thanks for the input.
Reply
#4

(11-28-2017, 11:40 AM)Petrusilius Wrote: Unfortunately the $_SERVER['HTTP_X_REQUESTED_WITH'] is not an official PHP variable, but I managed to find some difference between the regular user agent string and the user agent string from an app.

Thanks for the input.

Nothing in $_SERVER that is prefixed with 'HTTP_' can be listed as an "official variable", because every such variable simply corresponds to HTTP headers that may or may not be sent by the client. That doesn't mean you can't use them, they're as standard as they can be.

But the fundamental issue here is that there's no reliable way to detect browsers from PHP, or any other server-side language - any info that you may get is self-reported. Browsers will by default send such headers to indicate what they are, but users can modify that behavior and either change the info string being sent, or turn it off entirely. In that sense, the User_agent library is actually useless for anything but cosmetics.

Only JavaScript, by virtue of being executed in the browser itself, can reliably tell you what the user agent is or what features it has.
Reply




Theme © iAndrew 2016 - Forum software by © MyBB