Page 1 of 1

Detecting Browser

Posted: Fri Nov 26, 2004 9:12 am
by DudeBori82
Is there a way in PHP to detect what brand/version of browser the client is using? I need to make a way to redirect users of a specific browser to a specific site.

Posted: Fri Nov 26, 2004 10:01 am
by Crom
Why can't you do it in Javascript? Seems it is the only way. PHP is server-side but you need client-side check. You can in Javascript check version and then thru document.location redirect to desired site.
Cheers.

Posted: Fri Nov 26, 2004 10:26 am
by josh
Really?

If javascript is the only way then the get_browser() function and $_SERVER['HTTP_USER_AGENT'] must be useless huh?

'HTTP_USER_AGENT'

Contents of the User-Agent: header from the current request, if there is one. This is a string denoting the user agent being which is accessing the page. A typical example is: Mozilla/4.5 [en] (X11; U; Linux 2.2.9 i586). Among other things, you can use this value with get_browser() to tailor your page's output to the capabilities of the user agent.


http://us2.php.net/manual/en/function.get-browser.php



:D

Posted: Fri Nov 26, 2004 10:31 am
by Crom
Oh God, seems I crapped. Sorry. :)
jshpro, thanks for a tip