Two features meant to aid server-side feature detection

Jul 13, 2012 19:51 GMT  ·  By

When announcing the availability of IE10 Platform Preview 1, Microsoft also unveiled new IE10 user-agent string for the browser.

While the feature remained mostly unchanged, two new additions were announced for Internet Explorer 10 in the latest pre-release flavor of Windows 8, namely Release Preview.

According to a recent blog post from Tony Ross, Program Manager, Internet Explorer, both of them were meant to aid server-side feature detection.

“The first addition enables detecting whether a machine has touch-capable hardware via a new Touch token, the aforementioned blog post reads.

Using this token you can present a touch-friendly version of your site to users with touch-capable hardware (typically, in the case where your normal site is not touch-friendly).”

One thing that developers still need to take into consideration is the fact that users with touch-capable hardware are also offered the possibility to use a mouse and keyboard for navigation.

The token can fit into the user agent string as in the examples below:

IE10 on a machine without touch-capable hardware: Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.2; Trident/6.0) IE10 on a machine with touch-capable hardware: Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.2; Trident/6.0; Touch)

“If you're detecting touch support client-side, do not sniff the user agent string; use navigator.msMaxTouchPoints instead. If the property exists and returns a value greater than zero, the user’s PC has touch capability,” said blog post continues.

The second addition to the IE10 user agent string is an architecture token aimed at devices running under Windows RT (Windows 8 on ARM architectures). It was meant to complement existing values for other architectures:

32-bit IE10 on 32-bit Windows: Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.2; Trident/6.0) 32-bit IE10 on 64-bit Windows: Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.2; WOW64; Trident/6.0) 64-bit IE10 on 64-bit Windows: Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.2; Win64; x64; Trident/6.0) IE10 on Windows RT: Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.2; ARM; Trident/6.0)

These new additions apply to Internet Explorer 10 in both Metro and desktop mode, as they were designed to expose the same platform capabilities.

Developers should optimize the experience of their websites starting from system capabilities through feature detection, and not through the use of browser of environment detection.

They are also advised to use the requires ActiveX prompt when the available content is plug-ins dependable, so as to help users to switch to the desktop IE10 flavor until the content can be made plug-in free.