Sunday, August 05, 2012 3:54 PM
I'm using the WebBrowser object to display geographical maps using Openlayers. In general it works well.
The same page when loaded into several web browser applications (including IE9 on the same PC) has all of the openlayer controls fully styled.
Is there a way of forcing the WebBrowser to apply styles correctly to new elements as they are created, or to trigger the WebBrowser to re-apply styles to all currently existing elements?
Monday, August 06, 2012 7:05 AMModerator
I think maybe it is caused by the Internet Feature Controls[FEATURE_BROWSER_EMULATION]: http://msdn.microsoft.com/en-us/library/ee330730(v=vs.85)#browser_emulation
Please set it to IE9 value then test the page.
If it cannot work for you, then please let's see your Visual Studio solution zip, and the repro steps, thanks.
You can use the skydrive to upload the files.
Monday, August 06, 2012 10:01 AM
Thanks. It is definitely the FEATURE_BROWSER_EMULATION. Reading up on this, it seems that the WebBrowser runs by default in IE7 compatibility mode, and you have to set a registry key to make it use a later version as described in the link you gave.
My PC has IE9 installed, and when I set the registry key to 9000 (IE9) the WebBrowser reports that it is using MSIE 9.0 compatibility mode and the controls are fully styled - great!
Strangely, if I set it to 8000 (IE8) the Web Browser reports that it is using MSIE 9.0 (not 8) compatibility mode, and yet the controls are NOT fully styled.
I conclude that at least IE9 mode is needed for the styling to work correctly. But the WebBrowser seems to be incorrectly reporting that it is using MSIE 9.0 mode when it is really using 8.0 mode.
As IE9 is not available for Windows XP, then does this mean that users on XP will have to put up with incomplete styling?
Also, what does WebBrowser do if it finds the registry key set to 9000 (IE9) when only IE7 or IE8 is actually installed? ( I don't have an XP machine handy to check this out).
var txt = "Browser Name: " + navigator.appName + "\n";
txt += "Browser Version: " + navigator.appVersion + "\n";
Tuesday, August 07, 2012 8:42 AMModerator
I think it is let the document know the documentMode and then use the corresponding render to rend the page.
And I'm using this page to do the test: http://www.enhanceie.com/ua.aspx
There's a Document mode link at the bottom part, you can click on it to see the current document mode info.
- Edited by Mike Dos ZhangMicrosoft Contingent Staff, Moderator Tuesday, August 07, 2012 8:43 AM
Wednesday, August 08, 2012 9:54 AM
Thanks for the link. It's interesting, but only of use if you are able to structure the style sheets etc on the server. Also the lack of complete styling may be due to a lack of support for some styles in the compatible version of IE rather than something that can be fixed just by getting the browser to pretend to be another version through the user-agent. OpenLayers is a self-contained library, so I'll drop them a line.
Thursday, August 09, 2012 3:15 AMModerator
I think this forum would be helpful to you to research deeply about the WebBrowsers user-agent and other things: http://social.msdn.microsoft.com/Forums/en-US/iewebdevelopment/threads
Have a good day!