In a August 29, blog post on Windows Phone Developer blog, Charles Morris announced the availability of the Internet Explorer 9 (IE9) browser's user-agent (UA) string on Windows Phone "Mango".
Morris describes that the updates to the Mango UA string as the mirror changes made to the IE9 UA string on Windows (the only difference is the version numbers we are moving from):
- Application version is incremented from 'Mozilla/4.0' to 'Mozilla/5.0' to match other browsers. This change signals that IE9 is an interoperable browser.
- Version token is incremented from 'MSIE 7.0' to 'MSIE 9.0'.
- Trident token is incremented from 'Trident/3.1' to 'Trident/5.0'.
He said that "They have incremented the mobile-specific version from 'IEMobile/7.0' to 'IEMobile/9.0' and updated the OS version as well." Note that IE on WP has always sent the "short" UA string - pre and post platform registry value tokens aren't supported. With these changes, the default UA string for IE9 on Mango is:
Mozilla/5.0 (compatible; MSIE 9.0; Windows Phone OS 7.5; Trident/5.0; IEMobile/9.0; <manufacturer>; <model> [;<operator])
"The manufacturer and model information is populated automatically into the end of the UA string. The mobile operator also has the option to add their name to the end, so you may see that token at the end of the UA string on some Mango devices," informed Morris.
Morris explained that "IE9 on Mango supports compatible document modes similar to IE9 on Windows, controlled via a compatibility list. If a site is set to IE7 or quirks document mode on that list, the UA string that is sent will be":
Mozilla/4.0 (compatible; MSIE 7.0; Windows Phone OS 7.5; Trident/3.1; IEMobile/7.0; <manufacturer>; <model> [;<operator])
Finally, note that for app compatibility reasons, apps that use the WebBrowser control will send the old Windows Phone 7 (IE7) UA string until they are re-compiled with the WPSDK 7.1.
"If you do decide to use UA detection, we suggest using the "IEMobile" token to identify IE on WP as a mobile browser. If you would like to target modern markup at IE9 (and future versions of IE) on WP, you use a regular expression to extract the IEMobile version token then check if it is greater than or equal to 9.0," he said.
Call to action
- "If you are already detecting WP on your site using UA string detection, make sure that your detection logic continues to work correctly with the IE9 UA string. Based on our internal testing, there are several sites that detect the WP7 UA string but not the Mango UA string.
- If you have a tiered experience based on browser capabilities, now is a great time to start enabling richer functionality (e.g. HTML5 video) for IE9 on Mango devices. If you are using feature detection, some of this should happen automatically but be sure to grab the emulator or upgrade your developer devices to double-check. Look for deeper dives on new functionality enabled in IE9 in Mango in upcoming blog posts or let us know in the comments if there are specific topics you'd like to see covered!," explained Morris.