Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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 need IE9 to compare alongside other versions.

I'd like to have the .NET WebBrowser control use IE9 instead of the default version of IE on the machine. I have full control of the machine so it's no problem to hack away at system files or whatever else may be necessary.

Normally, this could be achieved by installing the update to IE, but in IE9's case, it installs a separate application, leaving the current version of IE untouched. This means the WebBrowser control continues to use the current version (which makes sense and was a smart move by MS, since IE9 is still under development). But in my (edge) case I need the WebBrowser control to use IE9.

Is it possible to embed IE9 in a .NET forms application?

EDIT

With Hans Passant's help I'm getting a bit further. Something very interesting is happening within IE9's prog files directory. There's a directory called "iepreview.exe.local" which, when removed, makes the IE9 Preview app use IE8 (checked it with the acid3 test).

Not quite what I want, but I'm wondering if this is some kind of redirection that I could exploit for my needs.

EDIT 2

I've tried applying the .local hack to both my copy of iexplore.exe and my .NET app and I've noticed something else interesting - both apps began using IE7 instead of IE8 (my version of IE) or IE9.

Could this be iexplore trying to use IE9 and then falling back onto IE7? Seems strange it would even have IE7 available, but that's the useragent string it starts using.

like image 559
Matt Brindley Avatar asked Jul 27 '10 17:07

Matt Brindley


People also ask

What is allow scripting Microsoft WebBrowser control?

This policy setting determines whether a page can control embedded WebBrowser controls via script. If you enable this policy setting, script access to the WebBrowser control is allowed.

What is WebBrowser control?

The WebBrowser control has several properties, methods, and events that you can use to implement controls found in Internet Explorer. For example, you can use the Navigate method to implement an address bar, and the GoBack , GoForward , Stop , and Refresh methods to implement navigation buttons on a toolbar.

What is WebBrowser C#?

The Web Browser control in C# allows you to host Web pages and other web browser enabled documents in your Windows Forms applications. You can add browser control in your C# projects and it displays the web pages like normal commercial web browsers .


1 Answers

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

like image 101
Someone Avatar answered Sep 20 '22 01:09

Someone