Use code to determine the browser version used by the client
Response.Write (request.servervariables["Http_user_agent"]);(seemingly ASP can also be used on this)
Or
Response.Write (request.useragent);
Mine is the IE7 output:
mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; SE 1.X;. NET CLR 2.0.50727;. NET CLR 3.0.04506.648;. NET CLR 3.5.21022; SE 1.X)
Google Browser output:
mozilla/5.0 (Windows; U Windows NT 5.1; En-US) applewebkit/532.0 (khtml, like Gecko) chrome/3.0.195.38 safari/532.0
Write a public method call in the background (you must add a reference)
Copy Code code as follows:
public static int Getbrowser ()
{
String browserinfo = Httpcontext.cu Rrent. Request.useragent;
if (Browserinfo.contains ("MSIE 7.0"))
{//ie7
return 1;
}
Else if (browserinfo.contains ("MSIE 6.0"))
{//ie6
return 2;
}
Else if (browserinfo.contains ("Firefox"))
{//ie6
return 3;
}
Else if (browserinfo.contains ("Chrome"))
{//Google
return 4;
}
return 5;
}