note 106798 deleted from tutorial.useful by googleguy
| From: | googleguy@php.net | Date: | Wed, 16 Jan 2013 05:31:02 +0000 |
| Subject: | note 106798 deleted from tutorial.useful by googleguy | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-193093@lists.php.net to get a copy of this message | ||
Note Submitter: Jay Walker
----
Suggesting a better way to detect the Firefox browser:
I see that, at least for a recent download of the Firefox browser,
the PHP command:
<?php
echo $_SERVER['HTTP_USER_AGENT'];
?>
returns:
Mozilla/5.0 (Windows NT 5.1; rv:8.0) Gecko/20100101 Firefox/8.0
...
So, note the term 'Firefox' in the returned string,
and therefore you can search for the substring 'Firefox'.
Therefore the PHP code:
<?php
if (strpos($_SERVER['HTTP_USER_AGENT'], 'Firefox') !== FALSE)
{
echo 'I see you are using Mozilla Firefox browser.<br />';
}
?>
works just fine.