jquery to get IE version inaccurate WebBrowser solution

Source: Internet
Author: User
Tags html page win32

  with $.browser.version often appear some inaccurate situation, recently encountered, did some summary, do not know whether comprehensive.  

  Using Javasript navigator.userAgent.indexOf ("MSIE 8.0") The result is the same.     1, loaded with WebBrowser htm, HTML page, at this time to get the version of IE is inaccurate, such as my machine is IE9, but after the WebBrowser loaded, $. The version obtained by the Browser.version method became 7.0, with the "<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: in the background through the registry to obtain:    code as follows: <span style= "FONT-SIZE:18PX;" >private int getieversion ()   {  using (Microsoft.Win32.RegistryKey Versionkey = Microsoft.Win32.Registry.LocalMachine.OpenSubKey (@ "softwaremicrosoftinternet 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 status of nested IFRAME, if the outer layer is IE8 resolution, the inner layers are IE9 parsing, 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. &nbSp   The application of this situation should be relatively small, 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.