Function to detect if the visitor is on an android device

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

This simple functions scans the user agent for the word "android" and returns true if found. Useful if there's something you only want android visitors to see (or not see).

Copy this code and paste it in your HTML
  1. function isItAndroid()
  2. {
  3. $ua = strtolower($_SERVER['HTTP_USER_AGENT']);
  4. if(stripos($ua,'android') !== false) return true;
  5. else return false;
  6. }

Report this snippet


RSS Icon Subscribe to comments

You need to login to post a comment.