Is it possible for the .NET WebBrowser control to use IE9?

前端 未结 3 1195
孤街浪徒
孤街浪徒 2021-02-13 07:11

I realise it\'s an early release and unstable. I wouldn\'t dream of swapping out the default webbrowser control for IE9 in any other project, but in this case I specifically

相关标签:
3条回答
  • 2021-02-13 07:27

    After a lot of Google-ing I have discovered that there are two different sets of keys for FEATURE_BROWSER_EMULATION for 32 bit and 64 bit applications. You need to set yours in the right place depending on the machine you are running. Also you need to make sure you install the correct version of the browser you want to emulate.

    32 bit:

    HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Internet Explorer\MAIN\FeatureControl\**FEATURE_BROWSER_EMULATION**
    
    Value Key: (DWORD) yourapplication.exe
    

    64 bit:

    HKEY_LOCAL_MACHINE\SOFTWARE\**Wow6432Node**\Microsoft\Internet Explorer\MAIN\FeatureControl\**FEATURE_BROWSER_EMULATION**
    
    Value Key: (DWORD) yourapplication.exe 
    

    The value to set this key to is (taken from MSDN here) as decimal values:

    9999 (0x270F) Internet Explorer 9. Webpages are displayed in IE9 Standards mode, regardless of the !DOCTYPE directive.

    9000 (0x2328) Internet Explorer 9. Webpages containing standards-based !DOCTYPE directives are displayed in IE9 mode.

    8888 (0x22B8) Webpages are displayed in IE8 Standards mode, regardless of the !DOCTYPE directive.

    8000 (0x1F40) Webpages containing standards-based !DOCTYPE directives are displayed in IE8 mode.

    7000 (0x1B58) Webpages containing standards-based !DOCTYPE directives are displayed in IE7 Standards mode.

    0 讨论(0)
  • 2021-02-13 07:28

    The only way IE9 could install side-by-side is when it uses new GUIDs for the interfaces and coclasses. Which means that you cannot use WebBrowser, it has the GUIDs hard-coded.

    There's one other option, using the AxHost wrapper. Right-click the toolbox, Choose Items, select the COM Components tab and locate IE9 in the list. No idea what it might be called, the old name was "Microsoft Web Browser", serviced by c:\windows\system32\ieframe.dll

    You'll have to make do without the friendly WebBrowser and HtmlDocument wrapper classes.

    0 讨论(0)
  • 2021-02-13 07:40

    Actually, you can modify your registry to force your program to use IE9 rendering. Go to HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Internet Explorer\MAIN\FeatureControl\FEATURE_BROWSER_EMULATION and add a new DWORD value named your program name (with .exe) and a decimal value set to 9999.


    You can also modify your registry to force your program to use IE9 GPU Rendering. Go to HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_GPU_RENDERING and add a new DWORD value named your program name (with .exe) and a hexadecimal value set to 1.


    THIS ONLY WORKS IF YOU ACTUALLY HAVE IE9! You must download IE9 first, before you do this, or it will not work. If you want to render the pages with IE8 just change the 9999 to 8888.

    Note: GPU Rendering is only available in IE9

    0 讨论(0)
提交回复
热议问题