Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Sep 16th, 2012  |  syntax: None  |  size: 0.70 KB  |  hits: 21  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. function isMobileDevice()
  2. {
  3.         var agent = navigator.userAgent.toLowerCase();
  4.        
  5.         var otherBrowser = (agent.indexOf("series60") != -1) || (agent.indexOf("symbian") != -1) || (agent.indexOf("windows ce") != -1) || (agent.indexOf("blackberry") != -1);
  6.         var mobileOS = typeof orientation != 'undefined' ? true : false;
  7.         var touchOS = ('ontouchstart' in document.documentElement) ? true : false;
  8.         var iOS = (navigator.platform.indexOf("iPhone") != -1) ||
  9.                 (navigator.platform.indexOf("iPad") != -1) ? true : false;
  10.         var android = (agent.indexOf("android") != -1) || (!iOS && !otherBrowser && touchOS && mobileOS) ? true : false;
  11.         if ( otherBrowser || mobileOS || touchOS || iOS || android ) return true;
  12.         return false;
  13. }