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.
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 toIE=8
, which instructs the web browser to display a page in IE 8 standards mode. An example would be:From this line in the following article it seems that this should work.
To change the default behavior of the Web Browser Control running in your application to match what IE itself does, you must set the FEATURE_BROWSER_EMULATION Feature Control Key.
For instance, you can mimic IE8's behavior (allowing sites to render in IE8 standards mode) as follows.
Inside HKEY_LOCAL_MACHINE\Software\Microsoft\Internet Explorer\Main\FeatureControl
Create a new key named FEATURE_BROWSER_EMULATION
Inside that key, add a new REG_DWORD with value 8000 with the name of your application's executable. E.g.:
Further details are at: http://blogs.msdn.com/b/ie/archive/2009/03/10/more-ie8-extensibility-improvements.aspx