(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) })(window,document,'script','//www.google-analytics.com/analytics.js','ga'); ga('create', 'UA-5276656-4', 'mobileesp.com'); ga('send', 'pageview');


The following methods are consistent across the currently supported platforms: PHP, Java ASP.NET, and Python.

New! Demo the PHP API using your device.


  • GetUserAgent(): Returns the useragent string. For PHP, Java, Python, C++, and JavaScript, this value is lowercase. For ASP.NET, the value is uppercase. The spelling of the method varies by platform.
    • In PHP, it’s called Get_Uagent().
  • GetHttpAccept(): Gets the full HTTP accept value. Browsers use this value to provide details about what kinds of content it can accept, such as images (e.g., PNG, GIF, JPG), text, and Java. This value is useful to detect for WAP and WML support in older devices.
    • In PHP, it’s called Get_HttpAccept().


All DetectXXX() methods return a boolean or equivalent.

  • PHP: Returns the integers 1 for TRUE or 0 for FALSE. These values can be configured as they are variables set at the beginning of the variable list.
  • Java: Returns the booleans TRUE or FALSE.
  • JavaScript: Returns the booleans TRUE or FALSE.
  • ASP.NET: Returns the booleans TRUE or FALSE.
  • Python: Returns the booleans TRUE or FALSE.
  • C++: Returns the booleans TRUE or FALSE



These methods group mobile phones into three broad tiers based on the capabilities of their browsers.

  • DetectTierTablet(): These have larger screens (8 inches or larger) and their browsers are HTML 5-capable. These browsers handle CSS and JavaScript very well, which means that modest AJAX sites with native (iPad or other) style components typically work great. Includes: Apple iPad and iPad Mini, Android tablets, BlackBerry PlayBook, WebOS HP TouchPad, etc.
    • Note that sometimes 7″ tablets report themselves as tablets while other times they report themselves as phones; it depends on the OEM. 
  • DetectTierIphone(): These are modern touchscreen  phones, though it’s important to remember that not all of them use WebKit browsers. These browsers handle CSS and JavaScript very well, which means that modest AJAX sites with native style components typically work great. When testing for this tier, include at least 3 platforms to be sure the app works great and isn’t an “iPhone-only” site. Includes:
    • iPhone and iPod Touch
    • Android phones & multi-media (MP3) players
    • Windows Phone 7, 8, and 10
    • BlackBerry OS 10
    • Ubuntu Mobile OS
    • And other small mobile OSes which often report themselves as “like Android”
  • DetectTierRichCss(): These devices can handle CSS reasonable well, so that iPhone- or Android-style UIs generally look fine. Unfortunately, JavaScript support is poor. For these reasons, in most cases, it’s probably best to serve these devices the generic mobile site rather than the iPhone Tier site. Includes:
    • Symbian S60 Open Source Browser (WebKit-based)
    • ‘High’ BlackBerry devices
    • Windows Mobile
    • Other WebKit-based browsers
  • DetectTierOtherPhones(): Detects for all other mobile devices, excluding the iPhone or Rich CSS tier devices. For these devices, it’s best to serve only the most basic CSS style, limited to little more than text color, alignment, and bold/italics.

To best use the device tier system, you might optimize your device detection logic like this:

  • If  DetectTierIphone(), send to the nice iPhone/Android/etc. optimized version of the site.
  • Else, if DetectMobileQuick(), send to the general mobile site with minimal CSS and no JavaScript.


DETECTION METHODS: Classes of Devices

These methods detect broad classes of mobile devices. However, for developing mobile-optimized web design, we recommend using the Device Tier methods above.

  • DetectSmartphone(): Detects any kind of smartphone device. This method doesn’t take into account browser capabilities, so it includes many older ‘smartphones’ (including BlackBerry and Symbian). In most cases, if you’re interested in modern touchscreen smartphones, you should use DetectTierIphone() instead.
  • DetectMobileQuick(): Detects most recent mobile phones.
  • DetectMobileLong(): Detects most mobile phones, including some older phones, and game consoles.
  • DetectGameConsole(): Rolls all of the gaming consoles up into a single method. Currently: Sony Playstation, Nintendo, Xbox.
  • DetectGamingHandheld(): Currently just the Playstation Vita which has an iPhone Tier browser.



  • DetectIphone()
  • DetectIpod()
  • DetectIpad()
  • DetectIphoneOrIpod(): When creating an iPhone-optimized site, use this method. Don’t ignore the iPod Touches!
  • DetectIos(): A convenience method for catching any iOS device.
  • DetectAndroid(): Detects any Android device: phones, multi-media players, tablets, and Google TV.
  • DetectAndroidPhone(): Includes phones and multi-media players; excludes tablets. Some phones running mobile OSes with small marketshare will report as ‘like Android,’ so will test positive here.
  • DetectAndroidTablet()
  • DetectGoogleTV()
  • DetectAndroidWebKit()
  • DetectWebkit(): Note that some desktop browsers also use WebKit rendering engine, including desktop Safari.
  • DetectWindowsPhone(): For Windows Phone 7, 8 and 10.
  • DetectWindowsPhone7()
  • DetectWindowsPhone8()
  • DetectWindowsPhone10()
  • DetectWindowsMobile(): Legacy Windows Mobile (before Windows Phone was launched).
  • DetectBlackBerry(): For all BlackBerry devices.
  • DetectBlackBerry10Phone(): For BlackBerry phones running the new BB OS 10.
  • DetectBlackBerryTablet(): For the PlayBook
  • DetectBlackBerryWebKit(): For any BlackBerry OS (10 or earlier) devices running a WebKit browser.
  • DetectBlackBerryTouch(): For (pre-OS 10) touchscreen devices, including Storm, Storm 2, Torch, and Bold Touch (99xx).
  • DetectBlackBerryHigh(): Newer (pre-OS 10) devices with moderate CSS support but poor JavaScript support. Examples: Storm, Bold, Tour, Curve2.
  • DetectBlackBerryLow(): Older BlackBerry devices with poor CSS and JavaScript support.
  • DetectS60OssBrowser(): This is the WebKit-based browser rather than the older proprietary browser Nokia used.
  • DetectSymbianOS(): Includes non-Nokia devices.
  • DetectPalmOS()
  • DetectPalmWebOS()
  • DetectPalmWebOS()
  • DetectWebOSTablet()
  • DetectWebOSTV(): Primarily from LG, but also Panasonic.
  • DetectOperaMobile(): For both Opera Mobile and Mini.
  • DetectKindle()
  • DetectAmazonSilk(): Detects the Android-based Amazon Kindle Fire when the Silk acceleration mode is on.
  • DetectGarminNuvifone()
  • DetectBada()
  • DetectTizen()
  • DetectTizenTV(): Primarily from Samsung.
  • DetectMeego()
  • DetectMeegoPhone()
  • DetectFirefoxOS(): Detects a mobile device (probably) running the Firefox OS. (Firefox don’t differentiate between Firefox OS and their browser running on other mobile platforms.)
  • DetectFirefoxOSPhone()
  • DetectFirefoxOSTablet()
  • DetectSailfish()
  • DetectSailfishPhone()
  • DetectUbuntu(): Detects either phones or tablets running Ubuntu Mobile OS.
  • DetectUbuntuPhone()
  • DetectUbuntuTablet()
  • DetectDangerHiptop()
  • DetectSonyMylo(): An old Sony home Internet tablet.
  • DetectMaemoTablet(): An old Nokia home Internet tablet (pre-Meego).
  • DetectArchos(): For Archos’ older non-Android-based video and music players.
  • DetectGameConsole(): A single method to detect all supported game consoles.
  • DetectXbox()
  • DetectSonyPlaystation()
  • DetectNintendo()
  • DetectGamingHandheld(): Includes the Playstation Vita.
  • DetectBrewDevice()
  • DetectWapWml()
  • DetectMidpCapable()