Detecting Browser

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
DudeBori82
Forum Commoner
Posts: 26
Joined: Thu Nov 18, 2004 10:09 am
Location: Florida

Detecting Browser

Post 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.
User avatar
Crom
Forum Newbie
Posts: 8
Joined: Mon Nov 08, 2004 2:50 am
Location: Ukraine
Contact:

Post 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.
josh
DevNet Master
Posts: 4872
Joined: Wed Feb 11, 2004 3:23 pm
Location: Palm beach, Florida

Post 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
User avatar
Crom
Forum Newbie
Posts: 8
Joined: Mon Nov 08, 2004 2:50 am
Location: Ukraine
Contact:

Post by Crom »

Oh God, seems I crapped. Sorry. :)
jshpro, thanks for a tip
Post Reply