code_junkie

How do I detect Mobile Safari server side using PHP?

Nov 11th, 2011
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.24 KB | None | 0 0
  1. <?php
  2.  
  3. /* detect Mobile Safari */
  4.  
  5. $browserAsString = $_SERVER['HTTP_USER_AGENT'];
  6.  
  7. if (strstr($browserAsString, " AppleWebKit/") && strstr($browserAsString, " Mobile/"))
  8. {
  9. $browserIsMobileSafari = true;
  10. }
  11.  
  12. ?>
  13.  
  14. $_SERVER['HTTP_USER_AGENT']
Add Comment
Please, Sign In to add comment