Detect user agent


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



Copy this code and paste it in your HTML
  1. function browser(){
  2. $keyname_ua_arr = array('HTTP_X_DEVICE_USER_AGENT', 'HTTP_USER_AGENT');
  3. foreach ($keyname_ua_arr as $keyname_ua) {
  4. if (!emptyempty($_SERVER[$keyname_ua])){
  5. $ua = $_SERVER[$keyname_ua];
  6. break;
  7. }
  8. }
  9. return $ua;
  10. }

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.