Page 1 of 2

Browsers

Posted: Fri Jul 20, 2007 3:19 am
by aetoc
I don't know if here is the right place to put this thread so if not sorry :D .

I would like to know if there is a way to know the browser name (IE, Opera e.t.c.)

I don't want to use JS becose what I want to do dosn't work with JS.


Any ideas?

Posted: Fri Jul 20, 2007 3:46 am
by Gente
$_SERVER['USER_AGENT'] should be the key

Posted: Fri Jul 20, 2007 3:57 am
by aetoc
I'm sorry Gente but the

Code: Select all

$_SERVER['USER_AGENT']
dosn't return anything.

Posted: Fri Jul 20, 2007 4:14 am
by trobale
It is:

Code: Select all

$_SERVER['HTTP_USER_AGENT']

Posted: Fri Jul 20, 2007 4:16 am
by aetoc
Thank you both.

Posted: Fri Jul 20, 2007 8:22 am
by Chalks
is that method infallible? Rather, what I mean is... what if I'm using a really obscure browser, like lynx or something? Every single method I've seen for browser detection had some weird caveat to it that makes it innefective in this or that situation.

Posted: Fri Jul 20, 2007 8:29 am
by volka
It's a header sent by the client. Nothing prevents the client from sending User-Agent: rama lama ding dong or no User-agent string at all.
Therefore if your well-being depends on detecting the user's browser you have a problem.

Posted: Fri Jul 20, 2007 8:35 am
by Chalks
volka wrote:User-Agent: rama lama ding dong
I would pay money for a browser that did that.

Seriously. :lol:

Posted: Fri Jul 20, 2007 8:40 am
by onion2k
If you don't have access to get_browser()'s browscap file and it's out of date, then http://sourceforge.net/projects/phpsniff/ is a reasonable alternative.

Posted: Fri Jul 20, 2007 8:44 am
by volka
Chalks wrote:
volka wrote:User-Agent: rama lama ding dong
I would pay money for a browser that did that.

Seriously. :lol:
https://addons.mozilla.org/en-US/firefox/addon/59

Posted: Fri Jul 20, 2007 8:56 am
by Chalks
Firefox, oh how I love thee. Let me count the ways!

Edit: if you find me a donate button, I'll donate a dollar. :D

Edit2: Opera, oh how I would love thee, if Firefox hadn't already stolen my heart. Let me count the ways!

Posted: Fri Jul 20, 2007 2:58 pm
by AKA Panama Jack
And in Opera you can edit/change the User Agent.

Posted: Fri Jul 20, 2007 5:57 pm
by feyd
onion2k wrote:If you don't have access to get_browser()'s browscap file and it's out of date, then http://sourceforge.net/projects/phpsniff/ is a reasonable alternative.
If get_browser()'s style of use is liked, viewtopic.php?p=237279#237279 ;)

Posted: Fri Jul 20, 2007 8:04 pm
by Todd_Z
Firefox does this too without an extension.

about:config
create a var called general.useragent.override and put whatever you want in the value.

i get defensive when people bring up stuff that opera has that firefox doesn't :)

Posted: Fri Jul 20, 2007 8:11 pm
by AKA Panama Jack
I just mentioned it to point out that browser sniffing can be a useless thing to do anymore because you never know what browser is really browsing your site.