note 99408 deleted from function.get-browser by cmb
| From: | cmb@php.net | Date: | Sun, 23 Feb 2020 08:56:45 +0000 |
| Subject: | note 99408 deleted from function.get-browser by cmb | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-214196@lists.php.net to get a copy of this message | ||
Note Submitter: henda dot exe at gmail dot com
----
Just a warning to anybody using the preg_match function to determine what browser the viewer is
using. I found with google chrome the array contains the following entries;
(Windows; U; Windows NT 6.1; en-US) AppleWebKit/533.4 (KHTML, like Gecko) Chrome/5.0.375.126
Safari/533.4
As I was using preg_match('/Chrome/i',$u_agent)) and
preg_match('/Safari/i',$u_agent)) i found my script was reporting browsers as safari when
infact the browser in use was google chrome.