Web browser 2.0....

.net , csharp Kuwait
  • 15 years ago

    Hi everyone

    I am using the web browser control in c# 2.0 and am having a little trouble!

    I can easily suppress the javascript errors dialog box (using the appropriate property) but I cannot seem to programmatically determine if there have been any javascript errors.  There must surely be a way to:

    a) Determine if there have been any JS errors after a document has loaded

    b) Traverse the error messages (with line numbers, etc...)

    Does anyone know how to get at this??

    Thanks


    Gee

  • 15 years ago

    As this would be the active x control rather than the .NET 2.0 Framework, have you had a look at the navigateerror event?

    http://msdn.microsoft.com/workshop/browser/webbrowser/reference/events/navigateerror.asp

  • 15 years ago

    I have just moved to .net 2.0 and have tried to steer away from wrapping the ActiveX browser component (as it generates HUGE assemblies!) - isn't there a way to get at this event using the flufiness of the framework?

    Thanks

    Gee

     

  • 15 years ago

    I thought about the reply above and tried to see if there was a way to dig into the underlying ActiveX without generating the huge wrappers and basically doing away with the fluffy framework implementation.

    It turns out you can, all you need is a sink...!

    http://msdn2.microsoft.com/en-us/library/system.windows.forms.webbrowser.createsink.aspx

    This example is so relevant, it could have been written specially for me!  This example shows how to subclass the webbrowser object and attach a sink in order to tack an event handler for the NavigateError event to the underlying ActiveX.  And breathe....!

    This just begs the question, why the hell did M$ not include this in the first place to save the agro of "plumbing"??!!

    Gee

     

Post a reply

Enter your message below

Sign in or Join us (it's free).

Contribute

Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“There are 10 types of people in the world, those who can read binary, and those who can't.”