4

I am just curious, why would a windows 7 desktop, installed with ie8, have Tablet PC 2.0 in its user agent string.

Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; Trident/4.0; SLCC2;
.NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media
Center PC 6.0; .NET4.0C; Tablet PC 2.0) Mozilla/4.0 (compatible; MSIE
8.0; Windows NT 6.1; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR
3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; .NET4.0C; Tablet
PC 2.0)

Is this a feature in Windows 7, how can I turn this off in IE8? Other browsers on the same computer don't have such string in the user-agent string they send.

As a result, one of our web application confuses this particular desktop client as a mobile (because of the tablet), hence returns the mobile version of our website to it.

Thank you!

7

This looks to me like a Media Center PC with the tablet edition of Windows 7 or Windows 2008 Server R2 installed (Both Identify as NT 6.1). Hardware like this shows up with a similar string.

Take a look at User Agent Strings for more help.

Personally I avoid using browser strings to select for tablet and mobile, its much more practical to use screen resolution and you're less likely to have fragmentation issues with the wide array of android tablets, phone and tablet/phones. My answer to this question covers the subject in more detail.

e.g.

<script type="text/javascript">
<!--
if (screen.width <= 699) {
document.location = "domain.com";
}
//-->
</script>
  • maybe you're right, thanks for your interesting suggestion. may i ask, did it really work for you like most of the time? :) – ultrajohn Apr 19 '12 at 7:41
  • @ultrajohn it does, we just did exactly this at work on a mobile site for barclaycard - testing indicates we were successful 95% of the time. What kind of app are you developing? – toomanyairmiles Apr 19 '12 at 8:59
3

Browser manufacturers like to cram unecessary information into their user-agent strings for a variety of reasons. Originally it was to fool browser sniffers that were excluding IE from their website (that's why you see Mozilla/4.0 (compatible; in IE's user-agent). It looks like Microsoft is cramming everything IE8 can be used with into its user-agent which isn't particularly useful, and in this case, problematic.

You can change your user-agent if you want but that won't change the fact that every other IE8 user will get the mobile version of your site. A better solution would be to improve the browser sniffer you're using and account for this in it. Or better yet, use a responsive design instead.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.