Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MSIEs WebBrowser control hosted in winforms app runs in compatibility mode

I'm hosting MSIE in a winforms form. Unfortunately it insists on running in compatibility mode regardless of if I give it a page that runs in IE8 mode in stand-alone IE. The effect of that is that some content that renders correctly in stand-alone MSIE gets completely mis-aligned and messed up in the hosted control.

Besides document type etc, is there some magic way to tell the webbrowser that I want it to render the page the same way as if I loaded it in stand-alone MSIE?

I don't want to use the registry key override ( http://blogs.msdn.com/b/ie/archive/2009/03/10/more-ie8-extensibility-improvements.aspx ) due to my form being part of an add-in for another app. I don't want to change the IE behavior for the main app and I don't want to change it for other add-ins running under that app. I only want this to work within the browser hosted in my form, not app-wide and not process-wide.

like image 654
KristoferA Avatar asked Aug 24 '10 07:08

KristoferA


1 Answers

I have not tested this, but how about using the META tag, along with the HTTP-EQUIV attribute, to set the X-UA-COMPATIBLE value to IE=8, which instructs the web browser to display a page in IE 8 standards mode. An example would be:

<meta http-equiv="X-UA-Compatible" content="IE=8" />

From this line in the following article it seems that this should work.

By default, applications hosting the WebBrowser Control open standards-based pages in IE7 mode unless the page contains an appropriate X-UA-Compatible header. You can change this by adding the name of the application executable file to the FEATURE_BROWSER_EMULATION feature control key and setting the value accordingly.

like image 83
Garett Avatar answered Nov 07 '22 13:11

Garett