(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');

MobileESP Now Supports Packagist!

Thanks to Demian K., who uses MobileESP on some Villanova University-affiliated sites, MobileESP on Github now supports Packagist!


Note the addition of the new “composer.json” file at the top level. This file provides all of the meta-data necessary for the Packagist system.

If you use Packagist to help manage components in your projects, then you’ll be able to leverage this new feature in your projects.

Thanks, Demian!

Posted in General

MobileESP: Updated & Live on GitHub!

Good news! The core MobileESP libraries have been updated with some long-overdue enhancements: PHP, JavaScript, Java, C#, C++ and Python. There are a few more useragent strings added to the testing spreadsheet, as well. Updates are now live on GitHub:



New support for: Windows Phone 10, Firefox OS, Ubuntu Mobile OS, Sailfish, Tizen TV, WebOS TV. Removed support for Opera Android Phone and Tablet. Updated DetectTierIphone(), DetectTierTablet(), DetectSmartphone(). Added additional features to the C# and Python libraries, catching them up to PHP.

New detection methods:

  • DetectWindowsPhone10()
  • DetectFirefoxOS(): Detects a mobile phone or tablet device (probably) running the Firefox OS. However, this is challenging. Firefox don’t differentiate between Firefox OS and their browser running on other mobile platforms.
  • DetectFirefoxOSPhone()
  • DetectFirefoxOSTablet()
  • DetectSailfish(): We found a useragent for phones but couldn’t find one for tablets.
  • DetectSailfishPhone()
  • DetectUbuntu()
  • DetectUbuntuPhone()
  • DetectUbuntuTablet()
  • DetectMeegoPhone(): For Meego phones.
  • DetectTizenTV(): For Samsung Tizen OS smart TVs.
  • DetectWebOSTV(): For LG and Panasonic smart TVs running WebOS.

Updated Methods:

  • DetectTierIphone(): Added support for Windows Phone 10, Sailfish, Ubuntu Mobile OS and Firefox OS.
  • DetectTierTablet(): Added support for Ubuntu Mobile OS and Firefox OS.
  • DetectSmartphone(): Added support for Meego phones.
  • DetectMeego(): Changed definition. Now, this means any device. Introduced DetectMeegoPhone() for phones in particular.
  • DetectAndroidPhone(): Removed the special check for the obsolete HTC Flyer tablet.
  • DetectAndroidTablet(): Removed the special check for the obsolete HTC Flyer tablet.
  • DetectWindowsPhone(): Updated to include Windows 10.

Removed Methods:

  • DetectOperaAndroidPhone(): Removed this function. Opera changed its useragent string strategy. This method was no longer reliable.
  • DetectOperaAndroidTablet(): Removed this function. Opera changed its useragent string strategy. This method was no longer reliable.

C# and Python in Particular

These libraries hadn’t seen any love in awhile, so they were caught up to PHP. New features included adding Windows Phone 8 and 10, BlackBerry BB10, Bada, and significant updates to the Tier iPhone and Tablet methods.

Live Tests

Test the updated libraries directly online:

Request for Help: Bug Checking

Anthony checked for bugs in the PHP and JavaScript libraries, but doesn’t have the environments set up to check in the other libraries: Java, C#, C++ and Python. There always seems to be a parens or quote misplaced… Can you help?

Python Question

We’ve been notified that the Python library doesn’t follow the Python community coding standards regarding method names in lower case with underscores separating elements rather than camel case. What do y’all think about this? Would it be better to conform to the Python standards or keep the method names consistent between libraries? Please let Anthony know.


Contact Anthony directly: anthony.hand@gmail.com

Posted in Code Updates, MobileESP APIs, UserAgent Test Strings

Working on an update…

Boy, where did the time go?!?

An across the board update for the MobileESP libraries is long overdue. And I’m working on it!

I’m almost done with a significant update, adding support for new mobile OSes Firefox OS, Sailfish, Ubuntu Mobile, plus a new detection function for Windows Phone 10. I’m also adding in detection methods for Tizen and WebOS smart TVs. As well as a bit of housekeeping.

I’ve also been looking at expanding the list of useragent test strings, especially for the new detection methods.

The update is being done in my free time, so I expect to finish by the end of next week. (No later than May 22!)

As usual, I only have access to testing the PHP and JavaScript libraries. Please let me know if you can do some testing on the Java, C#, Python or C++ libraries. No matter how careful I am, I seem to always forget a parenthesis here or there…

Posted in General

MobileESP: Now hosted at GitHub!

As you may have heard, Google is in the process of shutting down the Google Code site, which is where MobileESP had been hosted.

So, due to popular demand by the user base, the new home for MobileESP is… GitHub! Please update your bookmarks:


Links on this site to Google Code have been updated to GitHub. We know you have a membership with GitHub, so please star the project for easy access! 😉

FYI: There haven’t been any significant major shifts in the industry lately, so there hasn’t been much need to update the code. That being said, there are a couple of minor items in the backlog that I expect to work on by the end of April. Time for a little Spring Cleaning & updating.

Comments? Questions? Requests? Send me an email: anthony.hand@gmail.com

Posted in General

Where Should I Put a Custom DetectXXX() Block?

Wow! Where has the year gone?!? How can it be September already? It’s been a beautiful year and it’s gone by so quickly…

An MIT alum and entrepreneur wrote me recently with a good question. While building out and testing a new e-commerce site, they encountered a very strange useragent and wanted to build a custom detection method to catch it. He wasn’t sure the best way to integrate such a custom detection feature into the codebase. This is what I might recommend.

Let’s say you were using PHP. To keep the code fairly modular and easy to maintain over time, I might recommend creating a custom DetectXXX() method that you could easily copy forward into new MobileESP versions. If you wanted to check automatically every time, then put a call to it in the DetectMobileQuick() method. For example:
   function DetectMobileQuick()
      //Keep all the stuff at the top unchanged...

      //Finally, call your custom method
      if ($this->DetectCustomAgents() == $this->true)
         return $this->true;
         return $this->false;
   function DetectCustomAgents()
      if (stripos($this->useragent, "silly_that_i_have_to_do_this") > -1)
         return $this->true;
         return $this->false;
Good luck on your new venture, Bill!
– Anthony

Posted in General, How To - PHP, MobileESP APIs

MobileESP – Ported to C++!

A kind member of the community has just ported MobileESP to C++!

Kiran T. wrote me recently asking if it would be okay to port MobileESP to C++. Of course, I said yes. Kiran has also volunteered to help maintain the C++ codebase moving forward.

If you’re in the market for some mobile device detecting smarts in C++, venture over to the Google Code repository and download some fresh awesomeness:


Note that the end of the file contains a sample code snippet illustrating how to use the C++ library in a production environment.

Thank you, Kiran — for both porting MobileESP to C++ in the first place and for offering to help maintain it!

Posted in Code Updates, General, MobileESP APIs

Firefox OS Detection Recipe

Hi, folks —

The next update to MobileESP will support detection of smartphones running the Firefox OS. In the meantime, here is the recipe if you need it post-haste.

Mozilla thankfully publishes their useragent string pattern on their developer web site. The general pattern for the useragent string is: “Mozilla/5.0 (Mobile; rv:18.0) Gecko/18.0 Firefox/18.0”.

You’d think that we could just stop at looking for just instances of “firefox” and “mobile”, but unfortunately, that wouldn’t be enough. Their browser for Android meets that criteria, too. So you have to look for “firefox” AND “mobile” AND NOT “android”. So the detection function for PHP would look like this:

var $engineFirefox = 'firefox'; //A new global variable

function DetectFirefoxOsPhone()
   if ((stripos($this->useragent, $this->engineFirefox) > -1) &&
      (stripos($this->useragent, $this->mobile) > -1) && 
      (stripos($this->useragent, $this->deviceAndroid) < 0)) //and no index
      return $this->true; 
      return $this->false; 


An update along these lines will be published soon for the main code libraries.

By the way, we’re still looking for the useragent strings for Sailfish OS and Ubuntu Mobile OS. Please let us know if you come across them!

Happy coding!



Posted in General, MobileESP APIs

MobileESP for Python Updated

Just a quick note…

Thanks to the eagle eyes of one Edward P. from the UK, a little bug in the detectIphoneTier() has been fixed. Those damn ‘self’ declarations in Python…  🙂

Thanks, Edward!

Posted in Code Updates

MobileESP – UserAgent Test Strings Updated!

With the July release of the long-awaited update to the MobileESP codebase, we are also releasing the latest version of the useragent test strings that we use. We added a few more, especially to support the new detection methods for BlackBerry 10, Bada, and Tizen among others. Enjoy!

Download UserAgent Test Strings (August 1, 2013 edition)

– Anthony

Posted in General, UserAgent Test Strings

MobileESP – Updated at last! WP8, BB10, Tizen & More

Hi, folks!

I apologize for the terrible delay in updating the MobileESP code base. I’m afraid it was a case of “life happens”: I started a new day job in December and then took up cycling in January and trained intensely for 5 months to participate in the AIDS/LifeCycle charity bicycle ride from San Francisco to Los Angeles in June. The ALC was an amazing experience, but it also demanded a huge amount of my time. To the several MobileESP donors to my ALC ride, I say thank you again! In addition to all of that, my Mac laptop died and it took awhile to recover the data. (It turns out they’re deathly allergic to Diet Coke. Who knew?)

Hopefully, it will at least be worth the wait!

Here is a highlight of the updates noted in the Change Log:

  • Added new detection support for these OSes: Windows Phone 8, BlackBerry 10, Tizen, Bada, and Meego.
  • Added detection support for the Playstation Vita which appears to have an iPhone-class browser. It’s a nice handheld gaming device, so I created a new device category for DetectHandheldGamingDevice().
  • Tweaked the DetectTierIphone() method: Added Tizen, WP8, BB10 and PS Vita support.
  • Added detection support for the Obigo mobile browser to DetectMobileQuick().

For the JavaScript codebase, switched the code to use the Object Oriented style integration method. This technique will help prevent namespace collisions on variables and methods. I haven’t updated the OOP JavaScript sample yet, but until then, studying that sample is a great way to get started. For more information on the new MobileESP OOP JavaScript approach, please review the earlier blog piece:


I’ve been updating the MobileESP user test strings in parallel with this code update. I’ll add a separate blog post with the updated strings shortly.


The PHP and JavaScript demo pages are up now, so please check them out:



There are three promising mobile platforms launching soon, the Firefox Mobile OS, Ubuntu Mobile OS, and Sailfish OS. (Interesting fact: Sailfish builds on the foundation of Meego.) We’re keeping an eye out for them and hope to update the MobileESP codebase with detection support for these devices soon. So if you have more info about their native browsers’ capabilities as well as their useragent strings, please let me know!


The updated code files are Google Code now. Please keep an eye out for little bugs and let me know if you find any! I seem to have a nasty habit of forgetting a parens here or a $ there.


And again to everyone, my apologies for this code update delay.

Enjoy the summer!

– Anthony

Posted in Code Updates, General, MobileESP APIs

Happy New Year!

Happy New Year, everyone!

This is just a quick note to let you know that we’re working on some updates to start the year off right! Windows Phone 8, BlackBerry OS 10, Tizen — and more. Plus we’re updating the library of useragent test strings.

So look for this update very soon…

Until then, be safe & be merry!


Posted in General

BlackBerry Device Detection Recipes

Hi, folks —

A developer using MobileESP for a commercial project and I recently exchanged emails about BlackBerry device detection. Generally speaking, the BlackBerry OS has lagged other smartphone OSes with regards to browser capabilities. This situation has made it challenging for web developers who wish to provide quality experiences on their web sites to BlackBerry OS users.

MobileESP has lots of methods to detect BlackBerry devices — six! But all of them were created for specific purposes to help better target specific classes of BB devices. You may find it helpful to review the full list of BlackBerry detection methods in the MobileESp API documentation. Here is a little more info on the key detection methods nowadays.

The purpose of the old DetectBlackBerryHigh() and -Low() methods was really for the two levels of pre-OS 6 version devices. After OS 6, if you need BlackBerry specifically, then you might use one (or a combination of) the following:

  • DetectBlackBerry(): For any BlackBerry device, phone or tablet
  • DetectBlackBerryTablet(): For tablets only.
  • DetectBlackBerryWebKit(): For any “modern” BlackBerry device (phone or tablet) running BlackBerry OS. Generally speaking, this will test true on OS 6 or later.

So if you want a modern BlackBerry phone (OS 6 or later), then run this recipe:

  • DetectBlackBerryWebKit() && !DetectBlackBerryTablet()

Or if you want any BlackBerry phone (any version OS), the run this recipe:

  • DetectBlackBerry && !DetectBlackBerryTablet()

Of course when the new BlackBerry OS 10 launches in 2013, we will update MobileESP soon after!

And as you may have already read in the MobileESP blog, we generally recommend using the DetectTierX methods unless you are looking for a specific device for a specific purpose. For example, you should use DetectTierIphone() to detect all modern smartphones with an iPhone-class web browser running a variety of OSes.

Posted in General, Mobile Web Site Design