Re: get_browser();

From: Date: Tue, 19 Feb 2002 15:51:08 +0000
Subject: Re: get_browser();
References: 1 2 3 4 5 6  Groups: php.general 
Request: Send a blank email to php-general+get-85400@lists.php.net to get a copy of this message
Greg Donald wrote:
Use this to identify Netscape 4.x: if(strstr($HTTP_USER_AGENT,"Mozilla/4") && !strstr($HTTP_USER_AGENT,"MSIE")){ // is Netscape 4 } else { // is something else }
Is that going to catch the Mozilla spoofers, like webtv and opera?
Err, no... if they are being spoofed then why would it? Open a phpinfo() page in each of the browsers you wish to correctly identify, then you can see what user agent you need to search for to do whatever with... :) ------------------------------------------------------------------------ Greg Donald - http://destiney.com/ http://phprated.com/ | http://phplinks.org/ | http://phptopsites.com/ ------------------------------------------------------------------------ I don't need to take those steps. I do have a complet browser list. The problm with using plain browser detection, it doesn't work if your trying to disallow browser that do not or do poor CCS and advanced scripting. The only way is to see if they is to see if they can preform advanced scripting by using. if (document.getElementById && document.createElement). If your checking for only CSSS you can skip document.createElement it is only for Opera 5.
Gary


« previous php.general (#85400) next »