With $.browser.version often appear some inaccurate situation, recently encountered, did some summary, do not know whether comprehensive.
The result is the same with the Javasript navigator.userAgent.indexOf ("MSIE 8.0").
1, with webbrowser loading HTM, HTML page, at this time to obtain the version of IE is not accurate, such as my machine is IE9, but after WebBrowser loading, $.browser.version method obtained version is turned into 7.0, with " <meta http-equiv= "x-ua-compatible" content= "ie=5;ie=7;ie=8;ie=9;" /> "The version obtained after the forced parsing is still 7.0 if you want to webbrowser the correct result or modify the registry."
The solution to this problem is to get through the registry in the background:
Copy Code code as follows:
<span style= "FONT-SIZE:18PX;" >private int getieversion ()
{
using (Microsoft.Win32.RegistryKey Versionkey = Microsoft.Win32.Registry.LocalMachine.OpenSubKey (@) software\ Microsoft\internet Explorer "))
{
String version = Versionkey.getvalue ("version"). ToString ();
int iversion = Int. Parse (version. Substring (0, 1));
return iversion;
}
}</span>
2, with "<meta http-equiv=" x-ua-compatible "content=" ie=5;ie=7;ie=8; /> "Forced parsing, my machine is IE9, add this tag, then $.browser.version get the version is 8.0."
3, the situation of the nested IFRAME, if the outer layer is IE8 resolution, the inner level is IE9 resolution, so that the internal layer to obtain the version is IE9, but in fact the page is based on IE8 to resolve, which will result in judgments and actual implementation does not meet.
This application should be less, if encountered needs to be resolved through the internal and external layers of the decision can be resolved.