Webbrowser Control and JavaScript Errors

C# webBrowser script error

The script errors happen all of the time in the integrated Internet Explorer WebBrowser control even when it's using version 11. Modern websites rely heavily on massive Javascript files and dynamic rendering. You can see that just by watching that page load in a regular browser. The control just can't cut it some of the times.

You might want to try some alternative browser controls. There are no guarantees that it will work with any of them, but at least it's something to try.

  • Awesomium : Originally based on Chromium. I don't know if they still integrate Chromium changes or if they've gone in their own direction. It's free for personal use as well as commercial making less than $100k.
  • DotNetBrowser : Embed a Chromium-based WPF / WinForms component into your .NET application to display modern web pages built with HTML5, CSS3, JavaScript, Silverlight etc.
  • geckofx : An open-source component for embedding Mozilla Gecko (Firefox) in .NET applications.
  • Xilium.CefGlue : A .NET/Mono binding for The Chromium Embedded Framework (CEF) by Marshall A. Greenblatt.
  • BrowseEmAll : BrowseEmAll.Cef (Chrome), BrowseEmAll.Gecko (Firefox), BrowseEmAll Core API (Chrome,Firefox,IE - COMMERCIAL)

There are probably others, but this should give you a start with some of the more popular active projects if you want to pursue this route.

How to suppress script error message from a web browser control?

Please set the below property of WebBrowser in your form to suppress the script errors of browser and others from the activex control

WebBrowser1.ScriptErrorsSuppressed = True

WebBrowser Control is Running into Javascript Error that IE doesn't

The client script might be assuming a full browser is present and trying to access part of the browser outside the Document Object Model (DOM) of the page. For example, maybe the client script is trying to display something on the browser's status bar, or trying to modify a toolbar which isn't available in the WebBrowserControl. There could be numerous similar reasons.

If you do not have write-access to the web page in question to try fixing it, then play with WebBrowser Control properties such as ScriptErrorsSuppressed and ObjectForScripting

Error calling C# method from JS in winforms webbrowser control with parameters

Dumb mistake. I was evaluating that the function was not undefined as you normally would before calling a function from some other part of code. For some reason this evaluation was where the error was being raised, not the call itself (that was actually ok).



Related Topics



Leave a reply



Submit