jquery gets the solution for IE version inaccurate WebBrowser _jquery

Source: Internet
Author: User
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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.