PHP Firefox Detector


/ Published in: PHP
Save to your folder(s)

This handy little script will allow you to detect whether or not a user is running FireFox as their browser.


Copy this code and paste it in your HTML
  1. function is_firefox() {
  2. $agent = '';
  3. // old php user agent can be found here
  4. if (!empty($HTTP_USER_AGENT))
  5. $agent = $HTTP_USER_AGENT;
  6. // newer versions of php do have useragent here.
  7. if (empty($agent) && !empty($_SERVER["HTTP_USER_AGENT"]))
  8. $agent = $_SERVER["HTTP_USER_AGENT"];
  9. if (!empty($agent) && preg_match("/firefox/si", $agent))
  10. return true;
  11. return false;
  12. }

URL: http://www.aristoworks.com

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.