Solved

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

Posted on 2011-02-20
4
2,915 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

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

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

The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (http://www.ecb.europa.eu/stats/exch…
If you are a web developer, you would be aware of the <iframe> tag in HTML. The <iframe> stands for inline frame and is used to embed another document within the current HTML document. The embedded document could be even another website.
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…

856 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