To properly support Windows Mobile 6 and Windows Mobile 6.1 Internet Explorer Mobile clients on your ASP.NET site, you need to provide additional browser sections that will set the capability properties correctly. At the time of this writing, Microsoft does not have a browser definition available that sets the capabilities correctly for Internet Explorer Mobile on Windows Mobile 6 and Windows Mobile 6.1.
To fill this gap, I've defined the WM6Plus.browser browser capabilities file that is included in the download for this article. The WM6Plus.browser file defines the Internet Explorer Mobile capabilities for Windows Mobile 6 and Windows Mobile 6.1. I created the WM6Plus.browser file through a combination of research and experimentation; in addition to simply spending too much time doing browser capability tests, the 6.12 Browser Standards list, the Summary of Mobile Browser Features sections of MSDN were key to creating this browser capabilities file.
Note: |
|---|
|
To my knowledge, the capabilities defined in the file are correct but no one has performed a formal review of the capability definitions. You should review the file for accuracy and confirm that the file provides the desired functionality in your specific usage scenario.
|
The WM6Plus.browser file contains two browser sections and three gateway sections. The first browser section, IEMobile, handles setting the majority of Windows Mobile 6 and Windows Mobile 6.1 Internet Explorer Mobile capabilities.
<browser id="IEMobile" parentID="WinCE">
<identification>
<userAgent match="IEMobile (?'version'\d+\.\d+)" />
</identification>
<capture>
<userAgent match="MSIE (?'msieMajorVersion'\d+)" />
<header name="UA-PIXELS" match="(?'screenWidth'\d+)x(?'screenHeight'\d+)" />
</capture>
<capabilities>
<capability name="breaksOnInlineElements" value="false" />
<capability name="browser" value="IEMobile" />
<capability name="cdf" value="true" />
<capability name="defaultScreenPixelsHeight" value="${screenHeight}" />
<capability name="defaultScreenPixelsWidth" value="${screenWidth}" />
<capability name="ecmascriptversion" value="1.2" />
<capability name="javaapplets" value="true" />
<capability name="jscriptversion" value="5.6" />
<capability name="maximumRenderedPageSize" value="800000" />
<capability name="msdomversion" value="3.0" />
<capability name="numberOfSoftkeys" value="2" />
<capability name="requiresAbsolutePostbackUrl" value="false" />
<capability name="requiresCommentInStyleElement" value="false" />
<capability name="requiresHiddenFieldValues" value="false" />
<capability name="requiresOnEnterForwardForCheckboxLists" value="false" />
<capability name="requiresXhtmlCssSuppression" value="false" />
<capability name="preferredImageMime" value="image/jpg" />
<capability name="preferredRenderingMime" value="application/xhtml+xml" />
<capability name="preferredRenderingType" value="xhtml-basic" />
<capability name="screenPixelsHeight" value="${screenHeight}" />
<capability name="screenPixelsWidth" value="${screenWidth}" />
<capability name="supportsBodyClassAttribute" value="true" />
<capability name="supportsCallback" value="true" />
<capability name="supportsDivNoWrap" value="false" />
<capability name="supportsNoWrapStyle" value="false" />
<capability name="supportsSelectFollowingTable" value="true" />
<capability name="supportsStyleElement" value="true" />
<capability name="supportsTitleElement" value="false" />
<capability name="supportsUrlAttributeEncoding" value="true" />
<capability name="supportsXmlHttp" value="true" />
<capability name="tagwriter" value="System.Web.UI.HtmlTextWriter" />
<capability name="type" value="MSIE ${msieMajorVersion}" />
<capability name="vbscript" value="true" />
<capability name="version" value="${version}" />
<capability name="w3cdomversion" value="1.0" />
<capability name="win32" value="true" />
<capability name="xml" value="true" />
</capabilities>
</browser>
Whereas the WinCE browser section specifies the full format of the user agent in the <identification> section regular expression and extracts the various variable values using the same regular expression, the IEMobile section takes a different approach. The regular expression in the <identification> section of the IEMobile section matches any user agent containing the text IEMobile followed by a version number. The additional variable values are retrieved using separate regular expressions in the <capture> section.
Using this technique, as opposed to the more complex regular expression used in the WinCE section, provides for a much more flexible solution. Rather than requiring that IEMobile and MSIE appear at specific points in the user agent, these less complex regular expressions simply require that the value exist somewhere in the user agent; there are no specific formatting requirements beyond that.
For information such as the screen size that is no longer in the user agent, the regular expression in the <capture> section retrieves that value from the header sent for specifically for that purpose, ua-pixels.
As mentioned earlier in this article, the capabilities of Internet Explorer Mobile on Windows Mobile 6 and Windows Mobile 6.1 exceed those of Internet Explorer Mobile on Windows Mobile 5.0 especially in the area of Document Object Model (DOM) support and other client-side scripting capabilities. The new IEMobile section handles setting the capability properties for Internet Explorer Mobile on Windows Mobile 6 and Windows Mobile 6.1 to the appropriate values which are, of course, different than the appropriate values for Internet Explorer Mobile on Windows Mobile 5.0. There is, however, one challenge.
As you may know, Microsoft periodically releases Windows Mobile Adapter Kit Updates (AKUs) to Original Equipment Manufacturers (OEMs). These AKUs are updated versions of the Windows Mobile platform; they normally have bug fixes and other possible enhancements as compared to earlier releases of the same Windows Mobile version. Starting with Windows Mobile 5.0 AKU 3.3, Microsoft made a change to Internet Explorer Mobile that makes differentiating between Internet Explorer Mobile on Windows Mobile 5.0 and Windows Mobile 6 and Windows Mobile 6.1 slightly more difficult. Whereas Internet Explorer Mobile on most Windows Mobile 5.0 devices sends a user agent like that shown in the "Windows Mobile 5.0 User Agent" section earlier in this article, Internet Explorer Mobile on these later releases of Windows Mobile 5.0 sends a user agent formatted like those of Internet Explorer Mobile on Windows Mobile 6. The user agent from a post AKU 3.3 Windows Mobile 5 version looks similar to the following:
Mozilla/4.0 (compatible; MSIE 6.0; Windows CE; IEMobile 6.8)
The problem here is that the new IEMobile browser section will incorrectly set the client-side DOM capability property as being a higher version than is actually supported by Internet Explorer Mobile on Windows Mobile 5.0. To address this problem, the WM6Plus.browser file defines the following browser section.
<browser id="IEMobileNotAspNetAjaxCapable" parentID="IEMobile">
<identification>
<capability name="version" match="6\.8" />
</identification>
<capabilities>
<capability name="supportsCallback" value="false" />
<capability name="w3cdomversion" value="0.0" />
</capabilities>
</browser>
This <browser> section has a regular expression that matches a user agent containing IEMobile 6.8, the Internet Explorer Mobile version on Windows Mobile 5.0 AKU 3.3 and later AKUs. If the user agent contains this value, specific capability properties are set back to the appropriate values for Internet Explorer Mobile on Windows Mobile 5.0.
The remaining <gateway> sections in the WM6Plus.browser file set those capabilities that may differ between different Windows Mobile 6 and Windows Mobile 6.1 devices. These <gateway> sections use header information beyond that available in the user agent.
Note: |
|---|
For information on how <gateway> sections differ from <browser> sections see the Browser Definition Schema documentation in MSDN.
|
The first <gateway> section sets the color capabilities for the client device.
<gateway id="IEMobileColorScreenBitDepth" parentID="IEMobile">
<identification>
<header name="UA-COLOR" match="color(?'bitDepth'\d+)" />
</identification>
<capabilities>
<capability name="screenBitDepth" value="${bitDepth}" />
<capability name="isColor" value="true" />
</capabilities>
</gateway>
As you can see, this section simply extracts the color information from the ua-color header if it is available and sets the color capabilities appropriately.
The next two <gateway> sections are specific to Pocket PC-style devices: Windows Mobile 6 Classic and Windows Mobile 6.1 Classic, and Windows Mobile 6 Professional and Windows Mobile 6.1 Professional. This <gateway> section sets the inputType capability property from telephoneKeypad to virtualKeyboard for Pocket PC-style devices.
<gateway id="IEMobilePPC" parentID="IEMobile">
<identification>
<header name="UA-OS" match="Pocket PC" />
</identification>
<capabilities>
<capability name="inputType" value="virtualKeyboard" />
</capabilities>
</gateway>
The WinCE section of the pie.browser file sets the inputType capability property to telephoneKeypad but we know that Pocket PC-style devices have at least a virtualKeyboard. If you're using a device that has a physical keyboard but the ASP.NET inputType capability is not set correctly, review the user agent and other headers for information that either identifies the presence of the keyboard or uniquely identifies the device that has keyboard, and then add a <gateway> section that sets the inputType capability to keyboard.
Finally there is the <gateway> section that sets the supportsFileUpload capability property.
<gateway id="IEMobileUploadSupport" parentID="IEMobile">
<identification>
<header name="UA-OS" match="Pocket PC" />
<capability name="canInitiateVoiceCall" match="true"/>
</identification>
<capabilities>
<capability name="supportsFileUpload" value="true" />
</capabilities>
</gateway>
The purpose of the identification tests in this <gateway> section may not be immediately obvious. The only Windows Mobile 6 and Windows Mobile 6.1 devices that support file upload capability are Windows Mobile Professional devices, but there is no header that differentiates between a Windows Mobile Classic and Windows Mobile Professional device. Without specific headers identifying the device type, this section must identify the device type by checking for the two identifying characteristics unique to Professional devices: the appearance of Pocket PC in the ua-os header and support for making phone calls.
Note: |
|---|
|
If you're unclear on how these two characteristics identify a device as a Windows Mobile Professional device, remember the fundamental characteristics of each device type. A Windows Mobile Standard device is identified as a Smartphone in the ua-os header, a Classic device has Pocket PC in the ua-os header but doesn't have phone support, leaving only Professional devices as having Pocket PC in the ua-os header and the ability to initiate phone calls.
|
Once you download the WM6Plus.browser file, you need to add the file to the App_Browsers subfolder under your ASP.NET project. You can create the folder manually and copy the WM6Plus.browser file that accompanies this article into the subfolder, or you can have Visual Studio create the subfolder with a default browser file and then replace the default browser file contents with that of the WM6Plus.browser file.
To create the subfolder and browser file with Visual Studio, do the following:
-
With your ASP.NET site open in Visual Studio, from the Visual Studio menu, select Website | Add New Item…
-
In the Add New Item dialog box, select Browser File, and then enter the Name for the file. The file name can be anything you like as long as it has a .browser extension; I use WM6Plus.browser, which is also the name of the browser file in the accompanying download.
-
Click the Add button.
Visual Studio then displays the message shown in figure 1.
Figure 1. Visual Studio confirming the creation of the new browser file in the App_Browser subfolder
This message is simply informing you that the browser file must be placed in the App_Browsers subfolder to work correctly.
-
Click the Yes button.
Visual Studio automatically creates the App_Browsers subfolder if necessary, places a default version of the browser file in the subfolder, and then opens and displays the new browser file. The new browser file looks similar to figure 2.
Figure 2. The newly created default browser file
At this point, you need to replace the default browser file contents with the contents of the WM6Plus.browser file in the accompanying download.
-
Either copy the entire contents of the accompanying WM6Plus.browser file and paste it over the default contents in the new browser file, or copy the WM6Plus.browser file over the newly created browser file in the App_Browsers subfolder.
That's it, your Web site now has the information it needs to work properly with Internet Explorer Mobile clients browsing to your site from Windows Mobile 6 and Windows Mobile 6.1.