Project

General

Profile

IE 10 agent detection in WT

Added by Bogdan Cosescu over 11 years ago

Hi guys!

I have my WT app accessed from an IE 10. On the URL I type my https://MYCOMPUTERNAME and WT parses the IE user agent string and decides it's IE 7.

User agent string is :

userAgent = "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.1; WOW64; Trident/6.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; .NET4.0C; .NET4.0E)"

If I type https://192.168.200.10 WT says is IE 10. In this case user agent is:

userAgent = "Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.1; WOW64; Trident/6.0)"

This happens because IE 10 has an option in "Compatibility View Settings" which is enabled by default called "Display intranet sites in Compatibility View".

The problem is that I don't want to render my site in Compatibility View with IE7. I only support IE9 and above.

To fix that problem I added

addMetaHeader(MetaHttpHeader, "X-UA-Compatible", "IE=9");

to force IE9 rendering but with no effect since my app does not use progressive bootstrap.

While searching for a fix for this issue I saw a link from Microsoft

http://blogs.msdn.com/b/ie/archive/2011/04/15/the-ie10-user-agent-string.aspx

that identifies IE 10 in user agent using Trident/6.0.

Shouldn't WEnvironment::setUserAgent function take in account Trident number and ignore "MSIE 7." string?

There is a line there that does that for IE 9:

  else if (userAgent_.find("Trident/5.0") != std::string::npos)
    agent_ = IE9;

Replies (2)

RE: IE 10 agent detection in WT - Added by Wim Dumon over 11 years ago

Hello,

Looks like you're right, I fixed that for you.

Br,

Wim.

    (1-2/2)