Solved

Can't Make WebBrowser control in VB.NET  use IE8 Standards Mode

Posted on 2011-02-20
4
2,900 Views
Last Modified: 2012-05-11
I am working on a desktop application in VB.NET that uses a WebBrowser control on a form. The WebBrowser control is pointed at a .htm file on the local hard drive. When I open the application this file looks a total mess because it's designed for standards-compliant browsers - when I open it in IE8 it looks fine and when I switch to IE7 compatibility mode in IE8, it looks as it does in my application, so it seems my WebBrowser control is somehow forced into IE7 mode. The .htm file has a valid DOCTYPE of XHTML-strict.

Things I have tried so far to overcome the problem include:

Adding each of these to the head section of the .htm file:

<!--<meta http-equiv="X-UA-Compatible" content="IE=IE8" />-->
<!--<meta http-equiv="X-UA-Compatible" content="IE=Edge" />-->

Adding each of these to the registry:

[(HKEY_CURRENT_USER or HKEY_LOCAL_MACHINE)\Software\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_BROWSER_EMULATION]
"MyApplication.exe" = dword 8000 (Hex: 0x1F40)

[(HKEY_CURRENT_USER or HKEY_LOCAL_MACHINE)\Software\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_BROWSER_EMULATION]
"vshost32.exe" = dword 8000 (Hex: 0x1F40)

[(HKEY_CURRENT_USER or HKEY_LOCAL_MACHINE)\Software\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_BROWSER_EMULATION]
"MyApplication.exe" = dword 8888 (Hex: 0x22B8)

[(HKEY_CURRENT_USER or HKEY_LOCAL_MACHINE)\Software\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_BROWSER_EMULATION]
"vshost32.exe" = dword 8888 (Hex: 0x22B8)

None of the above makes any difference to the problem.
0
Comment
Question by:wwarby
  • 3
4 Comments
 
LVL 1

Author Comment

by:wwarby
ID: 34936238
I have now also tried uploading the .htm file to a web server to rule out the possibility that there is something specific about the behaviour of the WebBrowser control when using a local file. There isn't - it behaves the same when running from a web server hosted page.
0
 
LVL 1

Author Comment

by:wwarby
ID: 34936427
I have now also confirmed exactly which mode the WebBrowser control is in using JavaScript. It's Internet Explorer 8 running in Compatibility Mode with the document in IE7 Standards mode. Nothing I do seems to make the document run in IE8 Standards mode.
0
 
LVL 13

Accepted Solution

by:
F Igor earned 500 total points
ID: 34936703
It not a "server" problem. Only on the client browser (IE8)
Check if you use the correct name of your application ("MyApplication.exe") in the registry entry:

[(HKEY_CURRENT_USER or HKEY_LOCAL_MACHINE)\Software\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_BROWSER_EMULATION]
"MyApplication.exe" = dword 8000 (Hex: 0x1F40)

This is a "per program" entry (only applies to the programs that use the webbrowser control.
If it will work you should program an internal registry setting when you deploy your app to another computer...
0
 
LVL 1

Author Closing Comment

by:wwarby
ID: 34936776
Urgh. You know what the problem turned out to be? I'd forgotten I had to use the Wow6432Node registry path as I'm on a 64 bit platform. I wasn't setting the right registry key. As soon as I put it in the right place, it worked fine.

Thanks for the response anyway - it made me reconsider how I'd done the registry key which ultimately led to a solution ;)
0

Featured Post

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
This article offers some helpful and general tips for safe browsing and online shopping. It offers simple and manageable procedures that help to ensure the safety of one's personal information and the security of any devices.
Google currently has a new report that is in beta and coming soon to Webmaster Tool accounts. This Micro Tutorial will highlight new features for Google Webmaster Tools.
Shows how to create a shortcut to site-search Experts Exchange using Google in the Chrome browser. This eliminates the need to type out site:experts-exchange.com whenever you want to search the site. Launch the Search Engine Menu: In chrome, via you…

803 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question