note 99408 added to function.get-browser

From: Date: Mon, 16 Aug 2010 04:27:42 +0000
Subject: note 99408 added to function.get-browser
Groups: php.notes 
Request: Send a blank email to php-notes+get-171722@lists.php.net to get a copy of this message
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. ---- Server IP: 69.147.83.197 Probable Submitter: 80.195.188.160 ---- Manual Page -- http://www.php.net/manual/en/function.get-browser.php Edit -- https://master.php.net/note/edit/99408 Del: integrated -- https://master.php.net/note/delete/99408/integrated Del: useless -- https://master.php.net/note/delete/99408/useless Del: bad code -- https://master.php.net/note/delete/99408/bad+code Del: spam -- https://master.php.net/note/delete/99408/spam Del: non-english -- https://master.php.net/note/delete/99408/non-english Del: in docs -- https://master.php.net/note/delete/99408/in+docs Del: other reasons-- https://master.php.net/note/delete/99408 Reject -- https://master.php.net/note/reject/99408 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#171722) next »