The following methods are consistent across the currently supported platforms: PHP, Java ASP.NET, and Python.
- 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().
DETECTION METHOD RETURN VALUES
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.
- ASP.NET: Returns the booleans TRUE or FALSE.
- Python: Returns the booleans TRUE or FALSE.
DETECTION METHODS: Platforms and OSes
- 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
- DetectWebkit(): Note that some desktop browsers also use WebKit rendering engine, including desktop Safari.
- DetectWindowsPhone(): For both Windows Phone 7.x and 8.
- DetectWindowsPhone7(): Windows Phone 7 only
- DetectWindowsPhone(): Windows Phone 8 only
- DetectWindowsMobile(): Legacy Windows Mobile
- 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).
- DetectS60OssBrowser(): This is the new WebKit-based browser rather than the older proprietary browser Nokia used.
- DetectSymbianOS(): Includes non-Nokia devices.
- DetectOperaMobile(): For both Opera Mobile and Mini.
- DetectOperaAndroidPhone(): For Opera Mobile on Android smartphones.
- DetectOperaAndroidTablet(): For Opera Mobile on Android tablets.
- DetectAmazonSilk(): Detects the Android-based Amazon Kindle Fire when the Silk acceleration mode is on.
- DetectBada(): Samsung’s Bada OS.
- DetectTizen(): Intel and Samsung’s joint venture for a new OS for smartphones and other embedded devices.
- DetectMeego(): Nokia’s abandoned alternative smartphone OS.
- 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.
DETECTION METHODS: Classes of Devices
These methods detect broad classes of mobile devices, excluding the Apple iPad. However, for developing mobile-optimized web design, we recommend using the Device Tier methods.
- 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.
DETECTION METHODS: Device Tiers
These methods group mobile phones into three broad tiers based on the capabilities of their browsers.
- This list will be updated as new tablets are launched!
- Note that sometimes 7″ tablets report themselves as tablets while other times they report themselves as phones; it depends on the OEM.
- iPhone and iPod Touch
- Android phones & multi-media (MP3) players
- Windows Phone 7.x and 8
- BlackBerry OS 10
- BlackBerry OS 6 WebKit Browser
- Samsung Bada
- 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.