4

Is there any way to redirect the javascript console to a file?

I found this link

https://bitbucket.org/geckofx/geckofx-29.0/issues/9/how-to-get-javascript-consolelog-error

but it requires using devtools that im not going to have in the field.

There must be a simple way to redirect to a C# method.

Any help is appreciated.

mbalsam
  • 611
  • 1
  • 6
  • 16

1 Answers1

2

Capture the ConsoleMessage event and save each row to a file:

geckoWebBrowser.ConsoleMessage += GeckoWebBrowserOnConsoleMessage;

void GeckoWebBrowserOnConsoleMessage(object sender, ConsoleMessageEventArgs e)
{
    AppendToFile(e.Message);
}
Sire
  • 4,086
  • 4
  • 39
  • 74