note 10232 deleted from function.get-browser by irc-html
| From: | irc-html@php.net | Date: | Mon, 21 Jan 2002 00:45:59 +0000 |
| Subject: | note 10232 deleted from function.get-browser by irc-html | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-25594@lists.php.net to get a copy of this message | ||
Here's some quick code that will set 2 variables '$isie' and '$isns'.
---------------------------------
## GET BROWSER VERSION (NS/IE Check)
$isiepos = strpos($HTTP_USER_AGENT,"MSIE");
$isie = ( $isiepos>0 ? substr($HTTP_USER_AGENT,$isiepos+5,3) : 0 );
list($isnsver,$d) = explode(" ",$HTTP_USER_AGENT);
$isnsver = ( substr($isnsver,0,8)=="Mozilla/" ? substr( $isnsver,8 ) : 0 );
$isns = ( $isnsver>4.0 ? $isnsver : 0 );
---------------------------------
EXAMPLE: Let's say you have some formatting html that is for Netscape 6 (Mozilla/5.0) &
Internet Explorer:
if( $isie>=4 || $isns>=5 ){
NS6/IE4/IE5 stuff goes here
} else {
other (ex NS4)
};