Solved

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

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

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

I recently found myself in a Corporate Situation where the client had requested blocking access to any and all websites except his own Domain? Easy? I am sure this would be your answer but their requirement was, this has to be done without using…
SSL stands for “Secure Sockets Layer” and an SSL certificate is a critical component to keeping your website safe, secured, and compliant. Any ecommerce website must have an SSL certificate to ensure the safe handling of sensitive information like…
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…
How to create a custom search shortcut to site-search Experts Exchange using Google in the Firefox browser. This eliminates the need to type out site:experts-exchange.com whenever you want to search the site. Launch your Bookmark Menu: Press 'Ctrl +…

743 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

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now