With Windows Phone “Mango” declaring RTM and developer tools hitting “RC”, it is time to start getting websites updated for Internet Explorer 9 (IE9) availability on Windows Phone. In today’s post, we’ll describe changes to the browser’s user-agent (UA) string so that you can start testing those website updates.
Changes to the UA string for IE9 on Mango
The updates to the Mango UA string mirror changes made to the IE9 UA string on Windows. In fact, we can reuse most of the description from the original post announcing 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 (explained well in the great History of the user-agent string post). 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’.
In addition, we 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 Windows Phone has always sent the “short” UA string – pre and post platform registry value tokens are not 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.
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])
We’ll describe more details on how the compatibility view list works on Mango in a future blog post.
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.
While the UA string is an important means of identifying a browser, you should not rely on it to target specific functionality. Instead, use feature and behavior detection to detect specific browsers wherever possible.
If you do decide to use UA detection, we suggest using the “IEMobile” token to identify Internet Explorer on Windows Phone as a mobile browser. If you would like to target modern markup at IE9 (and future versions of IE) on Windows Phone, you use a regular expression to extract the IEMobile version token then check if it is greater than or equal to 9.0.
Call to action
- If you are already detecting Windows Phones 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!
Program Manager Lead, Windows Phone
Updated November 8, 2014 12:01 am