Updated: Windows Phone 7, BlackBerry Bold Touch, Kindle Fire

Hi, folks —

I made a few updates to the code today. Here is a summary of the changes, which are also listed at the top of each file.

PHP Only:

    • Created a constructor method per new features in PHP 5.0: __construct(). (Thanks, Lee C.!!)

All Code Libraries: PHP, JavaScript, Java, ASP.NET

    • Added a new variable for 2 versions of the new BlackBerry Bold Touch (9900 and 9930): deviceBBBoldTouch.
    • DetectTierIphone(): Moved Windows Phone 7 to the iPhone Tier. WP7.5’s IE 9-based browser is good enough now.
    • DetectBlackBerryTouch(): Updated to support the 2 versions of the new BlackBerry Bold Touch (9900 and 9930). (Thanks, Robert P.!!)
    • DetectKindle(): Updated to focus on eInk devices only. The Kindle Fire should be detected as a regular Android device.

As a side note, I also learned how to “checkout” and “commit” the code updates in SVN to Google Code. Now, file updates are truly updated versions of the same file in the Google Code system rather than an entirely new file with no history. I know, it’s a silly thing that I should have learned ages ago, and my apologies for not having done so sooner. So all of today’s updates are posted as Update r205. (Let’s just say that a switch to Mac and the Versions client were the main reasons…) 🙂





Posted in Code Updates, MobileESP APIs

Known Issue: Firefox on Android Phones

James M. sent us a note just before Christmas about a support issue affecting the Firefox browser on Android phones. Here is a quick overview of the issue.

Issue Summary: When using the Firefox browser on an Android mobile phone, the MobileESP code library erroneously reports the device as an Android tablet. An Android tablet is correctly identified as an Android tablet. This issue only affects mobile phones and similar small-screen Android devices like MP3 players (such as the Samsung Galaxy Player).

Root Cause: Mozilla uses the exact same useragent string for both phones and tablets. The string has the word “Android” in both. According to Google guidelines, Mozilla should include the word “mobile” in the useragent string for mobile phones. Unfortunately, Mozilla is not compliant with Google’s guidelines. The omission of the word “mobile” is the reason why phones are erroneously identified as tablets.

Work Around: MobileESP works by finding clues to the device type in the useragent string. Because Mozilla uses the same exact string when installed on both phones and tablets, MobileESP cannot recognize which type of device the browser is installed on. Here are some options:

    1. Don’t worry about it too much right now. Let’s hope Mozilla does the right thing and implements Google’s guidelines on the words to include in browser useragent strings on Android.
    2. Err on the side of mobile phones. Modify the code library to always return “true” for Android Phones and always return “false” for Android Tablets. You would do this by looking for the words “gecko” and “firefox” in the useragent string in each respective detection method. On the plus side, phone-optimized sites aren’t too awful on tablets. On the minus side, we aren’t fond of hacks like this, so we won’t officially add this hack to the MobileESP baseline.
    3. Write to Mozilla. Ask them to follow Google’s guidelines for useragent string construction. (We’re not sure if the best feedback forum is through the MDN or the mobile project forum. In the Android Market, Mozilla provides this email address for feedback: FirefoxforAndroid@mozilla.com)
We’re sorry that there is no fix to this issue at the present time within the MobileESP code base. It’s really up to Mozilla to fix this one themselves.
Posted in Code Updates, General

Happy New Year!

Happy New Year, everyone!

It’s 2012 and MobileESP is a little over three years old! Let’s pause a moment and reflect upon where we’ve come…

Project founder Anthony Hand started MobileESP in late 2008 to help solve a very real need — a lightweight, easy to use/customize/install code library for web publishers that offered a unique rollup of mobile detection by OS, device category, and “tier.” Initially, the code was shared on Anthony’s freelance mobile UI design web site, Hand Interactive. Two years ago, following up on the growing usage & code ports (to Java and ASP.NET) by the community, Anthony formally launched the MobileESP web site.

Since then, the code library has grown significantly, with many updates, refinements, additional code ports (e.g., Ruby), the addition of tablet support, API lists, new documentation and samples, and more. Many thanks to everyone who has contributed in any way. MobileESP wouldn’t be where it is today without your support!

Who knows what the future may hold? Assuming the Mayans got it wrong and the world won’t end this year, we expect to see MobileESP integrated into a greater range of projects and web sites across the interwebs. If you have created a cool project of your own that incorporates MobileESP, please let Anthony know so we can put a post about it on the blog!

Warm regards for a healthy, prosperous, and fun New Year!

Posted in General

Happy Thanksgiving!

To all of our American friends: Happy Thanksgiving!

This is just a quick note to let you know that we’re still alive. It’s just been a couple of months of very slow news, so to speak. Here are a few quick thoughts.

Windows Phone 7.5 (“Mango”): Our Samsung Focus device was recently updated to the newest version of Windows Phone. And well, well, well… The browser is actually pretty nice! It *seems* that the latest version of IE9+ on the phone runs iPhone-tier web pages (with the JavaScript and CSS) pretty well! Come the New Year (January 2012), we’ll update the libraries and add Windows Phone 7 back into the iPhone Tier of devices. We’ll just wait another few weeks for the legacy first generation of devices to finish updating… Most of them ought to have been updated by Christmas or so.

Amazon Kindle Fire: This intriguing 7″ Android tablet has a very interesting browser story. Its browser is called Silk and it includes a lot of processing on a server before it’s served to the device. Sometime after we receive ours, we’ll take a look at its useragent and try to put it through some tough iPhone Tier web sites to see how it measures up.

Barnes & Noble Nook Tablet: We’ll also try to take a look at the new Nook Tablet, also 7″ and running a customized version of Android. It is being released around the same time as the Kindle Fire.

Do you have any news or views on the new WP7.5 Mango, Kindle Fire, or Nook Tablet devices? If so, let us know in the comments!

Posted in General

DetectAndroidTablet() Updated

Those > and < marks get me every freakin’ time…

I just uploaded a new version of the MobileESP code to fix a bug I introduced in the last update in DetectAndroidTablet(). Please accept my apologies for that! Thank you to René B. for catching the bug.

Posted in Code Updates, General

Minify Your MobileESP!

Hi, folks —

As you may recall, the MobileESP code is written first and foremost so that it’s easy for you to read and customize. Although feedback from people in the field report that the code executes quickly and efficiently on production servers, there’s something you can do to help speed up processing a little more: minify it!

The process of minifying code removes white spaces at the very least, such as spaces, tabs, and line breaks. Depending on other options you choose, it may also remove comments and shorten the method and variable names (also called “obfuscation” because it also makes the code harder to read). So depending on the level of minification selected, you can enjoy significant size reductions!

Brooke D. kindly wrote in to share her favorite PHP minification tool online created by the web hosting company, CustomHost. Brooke reports that she’s been enjoying about a 50% reduction in file size to just 16 kb with no problems in performance. Check it out:


 Do you have a favorite online JavaScript minifier tool? Please let us know!


FYI: This page has been translated into Serbo-Croation: http://science.webhostinggeeks.com/mobilni-dizajn

Posted in General, Mobile Web Site Design

Updated: Fixed issues related to Opera Mini on Android

Hi, folks —

Here we go again on the Opera mobile browser ride…  🙂

So last week, we fixed the inaccurate detection results for the very good Opera Mobile browser on Android. This week, it’s the Opera Mini browser’s turn!

Today, I made two sets of updates to the MobileESP code libraries for PHP, Java, ASP.NET and JavaScript:

  1. All libraries: Updated the DetectAndroidTablet() method to prevent the Opera Mini browser from erroneously reporting as true. This fix was a significant re-write of the method’s code, so please let me know if I screwed something up. I only tested it in PHP and JavaScript and it appears to work fine….
  2. ASP.NET & JavaScript Only: Updated the techniques for initializing the user agent and httpaccept variables to handle null or uninitialized strings. Sometimes spiders and similar robots don’t initialize those values. I couldn’t test these updates here, so please let me know how these work in production! (PHP and Java already had solutions for this issue.)

So what is the Opera Mini browser? The Opera Mini browser started its mobile life as a way to bring (near) desktop functionality to feature phones. Now in the Android world, the Mini browser lives on as a highly data-efficient browsing alternative. Basically, all of the hard lifting for rendering a page is done on Opera’s servers, and they just send the phone a highly compressed file. It’s a great web page pre-processing solution.

But… Note that the Opera Mini browser is not processed on the client (phone/tablet) side — it’s pre-processed on the server. For this reason, the browser does not qualify as iPhone Tier. For now, we’re leaving it in the generic mobile device tier.

Thanks to Nolan K. for bringing the Opera Mini issue to my attention. And special thanks to John H. for providing the efficient ASP.NET code fix for the user agent and httpaccept variables.

As always, please help me check for errors & bugs. I can do a light test of the PHP and JavaScript code libraries, but I don’t have access to servers to check the ASP.NET or Java code libraries. Please let me know if you find something. Much obliged!

Posted in Code Updates, MobileESP APIs

MobileESP for Joomla!

The good folks at Weever recently sent us a note letting us know that they have ported MobileESP to a Joomla plug-in called (appropriately enough) “MobileESP for Joomla.” Fantastic!

Feel free to download the latest version of MobileESP for Joomla direct from the github repository, though it will be available directly in the Joomla Extensions Directory.


(Please note for various reasons that MobileESP for Joomla uses the GPLv3 license, in case it would be an issue of concern for you.)

The Weever folks also kindly added a new method for detecting the jailbroken Apple TV 2 device, which will be integrated into a future update of MobileESP. Thanks, guys!

To learn more about the MobileESP for Joomla plugin, please read their post in their Weever Labs blog:


Thanks for bringing the goodness of MobileESP to Joomla, Weever!

– Anthony



Weever provides a service that turns almost any web site into a mobile app for the major smartphone platforms. Check ’em out!

Posted in General, Projects Using MobileESP

Updated: Fixed issues related to Opera Mobile on Android

Hi, folks —

The Opera Mobile browser for Android is great. Unfortunately, the Opera dev team doesn’t follow Google’s guidelines for constructing useragent strings properly. As a result, the Opera Mobile browser on Android phones was falsely reporting itself as running on Android tablets rather than phones. Thanks to all of those who wrote in about it!

So I made the following fixes to get things working right:

  • Created 2 new methods:  DetectOperaAndroidPhone() and  DetectOperaAndroidTablet(). Although I dislike creating new methods willy nilly, these methods better encapsulate the Opera-specific issues and let’s us better track them over time if Opera continues to play by their own rules.
  • Updated DetectAndroidPhone() and DetectAndroidTablet() to properly detect devices running Opera Mobile.
  • Updated DetectMaemoTablet() to also disambiguate against Android.
  • Updated DetectTierIphone(). I removed the Maemo detection for two reasons. One was the false positives on Android (before the above fix). The other is that Nokia has discontinued the device and it’s more than 2 years old, so device usage probably has plummeted. Note that Maemo still detects in the quick mobile method!

I also made a few minor bug fixes that prevented the two C# code files from compiling properly. (Thanks, Marco!)

Please download the latest version of your favorite flavor of MobileESP! All code bases were updated: PHP, JavaScript, Java, and the two ASP.NET (C#) files.


Posted in Code Updates, MobileESP APIs

Download the Live API Demo Pages!

Hi, folks —

Numerous people have written me asking if they could download the Live API Demo pages we’ve posted over at Hand Interactive. They wanted to be able to see the API calls in context within real HTML code.

Well, I had some free time today so I whipped up a suitable export of the web pages for general consumption. (In other words, I fixed all the relative links, removed the Google usage tracking codes, removed the server-side includes, etc., etc.)

Download the MobileESP Live API Demo Pages for PHP & JavaScript.


There are a few important caveats to using the downloadable Live API Demo Pages…

  • Please keep in mind that it’s not the cleanest of HTML code since it was originally created for my internal use only.
  • The web page is based on a free web design template I downloaded from DCarter Design. Please visit the DCarter Design site for more information on re-using their design template resources, including the style sheets, image resources, etc.
  • Due to the effort involved in updating the regular Live API Demo pages and then porting those updates to the cleaned up, downloadable file set, I can’t guarantee that the downloaded Live API Demo pages will be 100% up to date with the latest API changes. But that’s okay. It’ll still be good enough for you to review the techniques we used and figure out how to apply them to your own needs.


We’ve also prepared a couple of extremely basic samples which you can download to study and learn more about how easy it is to integrate MobileESP into your web site. This blog post explains a little more about the downloadable samples.


Posted in General, How To - PHP, MobileESP APIs

Download New PHP & JavaScript Samples!

Hi, folks —

A few people have asked for simple examples using MobileESP. I’m most familiar with PHP and JavaScript, so I whipped up a few super basic samples.

These examples illustrate how easy it is to include MobileESP code in your web page, do a quick detect, then do something interesting. For example, some of the things you might want to do include:

  • Turn on & off features.
  • Optimize pictures, videos, and other multimedia content for a specific platform. For example, dynamically replace a Flash video with an H.234 video file for iOS devices.
  • Show a platform-specific notice or ad. For example, “You’re on a Windows Phone 7 device? Download our new app!”
  • Redirect a device to an alternate version of the web page.

The PHP and JavaScript examles follow the same user flow. Both examples are extremely simple and have a very basic setup: The user browses to a landing page that does a basic device detection. Then…

  • If it’s an iPhone Tier device (including iPod Touch, Android, WebOS, etc.), it’ll redirect to a basic web page saying, “iPhone Tier.”
  • If it’s any other mobile device (including BlackBerries, Windows Phone 7, PalmOS, and most feature phones), it’ll redirect to a web page saying, “Generic Mobile Page.”
  • All other devices will fall through the above filters to land on a page saying, “Hi! I’m a Desktop page!”

Download the MobileESP samples for PHP & JavaScript.

See a live demo of the MobileESP samples in action.


Posted in General, How To - PHP

Updated: Added Support for WebOS Tablet Detection

Hi, folks —

I updated the code libraries to include support for detecting the new WebOS tablet called the HP TouchPad. The new method is called DetectWebOSTablet(). This method has been added to: PHP, JavaScript, Java, and both ASP.NET bases.

I also updated the DetectTierTablet() method to include support for the WebOS tablets.

Thank you also to the multiple folks who wrote me about the syntax error in the detectTierRichCss() method in the Java library. Sorry about that!

As always, please help me check for errors & bugs. I can do a light test of the PHP and JavaScript code libraries, but I don’t have access to servers to check the ASP.NET or Java code libraries. Please let me know if you find something. Much obliged!

– Anthony

Posted in Code Updates, MobileESP APIs