Adjustment. NET control webbrowser the default browser kernel

Source: Internet
Author: User

Today, when debugging a program, a client using C # needs to telnet to a Web page and use the WebBrowser control. But I found something magical:

The current browser uses a kernel that can be obtained by logging on to the following website: http://ie.icoa.cn/

My version of IE is IE8, when using the IE login page, the kernel used is IE8, log in to the website as follows:

But when I log in to the page with WebBrowser, the kernel used for the display is IE7:

Program is a test program that contains only one WebBrowser, and the name of the program is TestWebBrowser.exe. It can be found that, although the same as the Trident kernel, but the kernel version used in the WebBrowser control is not the same as IE, which makes me wonder. Because the page I want to log in to is developed for IE8 and above, I need to try to get WebBrowser in the program to log in to the Web page with IE8 kernel.

After finding some information on the Internet, I found that it can be solved by the following method:

1. Enter "Regedit.exe" in the Start menu to enter the Registry Editor

2. Locate the registry key: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Internet Explorer\main\featurecontrol\feature_browser_emulation

3. Right-click in the blank area on the right and click "new" → "DWORD (32-bit) value"

4, the new item is named TestWebBrowser.exe, when editing the value, select the Radix "decimal", fill in the Value data, here fill in 8888

5, this time again into the debug directory generated good testwebbrowser, you can see the kernel version of the login becomes IE8!

It should be noted that in VS within the debugging method to enter the program, open the program is actually TestWebBrowser.vshost.exe, do not see the effect, you must open the debug directory under the TestWebBrowser.exe, to find the kernel version of the change. The reason that WebBrowser used the IE7 kernel before is. The WebBrowser control in net uses the IE7 compatibility mode to browse the Web page by default.

111111111 Dividing line 111111111

The above method relies on modifying the registry to complete the WebBrowser use of the kernel changes, but the light know to create a new registry key and set the value to "8888" is far from enough, the spirit of "know it but also know why" idea, I consulted the relevant MSDN page: https:// Msdn.microsoft.com/en-us/library/ee330730%28v=vs.85%29.aspx

The title of this page is: Internet Feature Controls (B.. C), which is the Internet function control, the chapter we are looking for is "Browser Emulation" (browser emulation). Since IE8, the feature_browser_emulation feature has been added to the registry to define the default emulation mode for IE.

The location of this feature in the registry is as follows:

The various possible values for this registry key are described below (see MSDN, purely hand-translated, if you have any shortcomings, please note)

    • 7000 (0x1b58)

Webpages containing standards-based! DOCTYPE directives is displayed in IE7 standards mode. Default value for Applications hosting the WebBrowser Control.

Contains the standard! The page for the DOCTYPE instruction will be opened in IE7 compatibility mode. the default value of the WebBrowser control .

    • 8000 (0X1F40)

Webpages containing standards-based! DOCTYPE directives is displayed in IE8 mode. Default value for Internet Explorer 8
Important in Internet Explorer, webpages containing standards-based! DOCTYPE directives is displayed in IE10 standards mode.

Contains the standard! The DOCTYPE instruction page will open in IE8 compatibility mode, IE8 the default value of the browser. For IE10, include the standard! The page for the DOCTYPE instruction is opened in IE10 compatibility mode.

    • 8888 (0X22B8)

Webpages is displayed in IE8 standards mode, regardless of the declared! DOCTYPE directive. Failing to declare a! DOCTYPE directive causes the page to load in Quirks.

Whether it is declared or not! DOCTYPE instruction, the page opens in IE8 compatibility mode. For not correctly declared! The page of the DOCTYPE instruction will be loaded in the weird mode (quirks modes).

    • 9000 (0x2328)

Internet Explorer 9. Webpages containing standards-based! DOCTYPE directives is displayed in IE9 mode. Default value for Internet Explorer 9.
Important in Internet Explorer, webpages containing standards-based! DOCTYPE directives is displayed in IE10 standards mode.

IE9, contains the standard! The DOCTYPE instruction page will open in IE9 compatibility mode, IE9 the default value of the browser. For IE10, include the standard! The page for the DOCTYPE instruction is opened in IE10 compatibility mode.

    • 9999 (0x270f)

Windows Internet Explorer 9. Webpages is displayed in IE9 standards mode, regardless of the declared! DOCTYPE directive. Failing to declare a! DOCTYPE directive causes the page to load in Quirks.

IE9, whether declared or not! DOCTYPE instruction, the page opens in IE9 compatibility mode. For not correctly declared! The page of the DOCTYPE instruction will be loaded in the weird mode (quirks modes).

    • 10000 (0x02710)

Internet Explorer 10. Webpages containing standards-based! DOCTYPE directives is displayed in IE10 standards mode. Default value for Internet Explorer 10.

IE10, contains the standard! The DOCTYPE instruction page will open in IE10 compatibility mode, IE10 the default value of the browser.

    • 10001 (0x2711)

Internet Explorer 10. Webpages is displayed in IE10 standards mode, regardless of the! DOCTYPE directive.

IE10, whether declared or not! DOCTYPE instruction, the page opens in IE10 compatibility mode.

    • 11001 (0X2AF9)

IE11. Webpages containing standards-based! DOCTYPE directives is displayed in IE11 edge mode. Default value for IE11.

IE11, contains the standard! The DOCTYPE instruction page will open in IE11 compatibility mode, IE11 the default value of the browser.

    • 11000 (0X2AF8)

Internet Explorer 11. Webpages is displayed in IE11 edge mode, regardless of the declared! DOCTYPE directive. Failing to declare a! DOCTYPE directive causes the page to load in Quirks.

IE11, whether declared or not! DOCTYPE instruction, the page will be opened in IE11 edge mode. For not correctly declared! The page of the DOCTYPE instruction will be loaded in the weird mode (quirks modes).

END

Adjustment. NET control webbrowser the default browser kernel

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.