質問

Is it possible to differentiate between request coming from IE7 and request coming from higher version of IE running in compatibility mode?

I would prefer a pure server side solution to something involving JavaScript.

役に立ちましたか?

解決

Check user agent for IE version and Trident version, like in this article:

string userAgent = Request.UserAgent; //entire UA string
string browser = Request.Browser.Type; //Browser name and Major Version #

if (userAgent.Contains("Trident/5.0")) //IE9 has this token
{
    if (browser == "IE7")
    {
        mode = "IE9 Compatibility View";
    }
    else
    {
        mode = "IE9 Standard";
    }
}
ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top