问题
I've made an application that fills the fields of a webform with data stored in a database. The problem is that when the WebBrowser loads, a JavaScript error pop-up raises and when I try to submit the form it won´t do it because (quote): "An error has occurred ."
I have read here that it uses by default IE4:
Replacing .NET WebBrowser control with a better browser, like Chrome?
And I have tried this, but it didn't work. It looks like it sticks to IE7 no matter what I do:
http://blogs.msdn.com/b/ie/archive/2009/03/10/more-ie8-extensibility-improvements.aspx
I would like to use the default WebBrowser control, but I could switch to "Chrome" or "FireFox" if necessary.
回答1:
I have done some investigation into this before! From what I remember reading...The WebBrowser control actually seems to render differently depending on your installation of IE, but, it will pick the lowest of IE's rendering modes.
Let me explain:
Lets say you have IE9 installed...IE9 can actually be forced to render pages in IE8, IE7 and quirks mode. (To test this, go into IE, and press F12. You should see a developer toolbar appear, and you can change compatibility and standards modes here). Of these, your WebBrowser control probably renders in IE7 mode, or Quirks mode if there are HTML errors.
Here is a great Q/A on this...How to put the WebBrowser control into IE9 into standards?
and here is an article regarding FEATURE EMULATION which will allow you to run a WebBrowser control in IE9 mode: https://stackoverflow.com/a/5357205/1033686
Hope this helps!
来源:https://stackoverflow.com/questions/12796070/change-default-webbrowser-rendering-mode-in-c-sharp