Pregunta

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.

¿Fue útil?

Solución

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";
    }
}
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top