note 10662 added to get_browser
| From: | harbater at teamgenesis dot com | Date: | Tue, 16 Jan 2001 10:04:05 +0000 |
| Subject: | note 10662 added to get_browser | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-9836@lists.php.net to get a copy of this message | ||
if (strstr(getenv('HTTP_USER_AGENT'), 'Mozilla'))
returns true for both Netscape and IE.
Here's what I got when I echoed $HTTP_USER_AGENT in 3 different browsers:
Netscape 4.08: Mozilla/4.08 [en] (Win98; U ;Nav)
Internet Explorer 5.5: Mozilla/4.0 (compatible; MSIE 5.5; Windows 98)
Neoplanet 5.2: Mozilla/4.0 (compatible; MSIE 5.5; Windows 98)
So instead of testing $HTTP_USER_AGENT for "Mozilla" try testing for "Nav" if
you want to check if the user's browser is Netscape.
http://www.php.net/manual/en/function.get-browser.php