2

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.

Community
  • 1
  • 1
user1569154
  • 19
  • 1
  • 5
  • possible duplicate of [Replacing .NET WebBrowser control with a better browser, like Chrome?](http://stackoverflow.com/questions/790542/replacing-net-webbrowser-control-with-a-better-browser-like-chrome) – Ria Oct 09 '12 at 09:11
  • Not necessary. What I really want is to change the default IE that the WebBrowser uses, but still using IE. I have already read that link (actually I posted it too) and is not the same question. – user1569154 Oct 09 '12 at 09:32

1 Answers1

2

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!

Community
  • 1
  • 1
Matthew Layton
  • 32,574
  • 37
  • 140
  • 255
  • I tried already changing FEATURE EMULATION but it didn´t work either. The error pop-up says that "The object does not accept this property or method" (translated from Spanish, it may not be completelly accurate) And it asks me to continue executing scripts in this page. – user1569154 Oct 09 '12 at 10:20
  • @user1569154, have you considered suppressing script errors?....http://msdn.microsoft.com/en-us/library/system.windows.forms.webbrowser.scripterrorssuppressed.aspx – Matthew Layton Oct 09 '12 at 10:34
  • The problem is that I need javascript to run without errors. I tried it anyways, and it did not work. – user1569154 Oct 09 '12 at 10:42
  • @user1569154, if you test the same page in your browser (IE, FireFox, Chrome etc), does it work here? if not, debug the error with FireBug (an addon for FireFox). – Matthew Layton Oct 09 '12 at 10:45
  • @user1569154, thinking about this logically, it may be the case that the .NET WebBrowser control does not support a fully fledged JavaScript engine! I am not an expert on which engine it uses, sorry. – Matthew Layton Oct 09 '12 at 10:46
  • Yes, it works perfectly even in IE, that´s why I think my WebBrowser is not using the installed IE in my pc... – user1569154 Oct 09 '12 at 10:49