I'm trying to use a conditional to present one line of HTML if the user is on MSIE, or another if the user is on netscape... i'm having some problem with it -- i dont understand why -- but if PHP can do the same thing i'll probably have better luck with it. Does php detect browsers? What is that code
seomike2003
5:46 pm on Apr 1, 2004 (gmt 0)
$_SERVER['HTTP_USER_AGENT']
mipapage
5:48 pm on Apr 1, 2004 (gmt 0)
$_SERVER['HTTP_USER_AGENT']
Check out the docs [es.php.net], they should sort you out.
jezra
5:49 pm on Apr 1, 2004 (gmt 0)
You can get the information you need from the server variable "HTTP_USER_AGENT". A quick and dirty would be something like this:
$agent = $_SERVER["HTTP_USER_AGENT"]; if ( strstr($agent,"MSIE") ) echo "you are using Internet Explorer";
However, some browsers allow the end user to change the user agent string. I hope this helps. jez
I use phpSniff which is very good. But it returns far more information than I need, so if anyone knows of a simpler version which just returns browser type and version please shout.