luca009
luca009

Reputation: 38

VB.Net GeckoFX disable dialog errors

While the title might be confusing, I hope this will explain it better. So, I want to make an VB.Net webbrowser with a GeckoWebBrowser control. The issue I am facing is that Gecko keeps opening error dialogs even tho I am catching the Error in my code. I just want to disable those dialogs and load an simple html site instead.

Code (Where wbMain is the GeckoWebBrowser control):

Function navigate(ByVal address As String)
    Try
        wbMain.Navigate(address)
    Catch ex As Exception
        wbMain.LoadHtml("<h1>An error has occurred!</h1><p>Description: " & ex.Message & "</p>")
    End Try
End Function

Gecko keeps doing those errors:

error (I can't post images yet)

But I just want it to display the html page instead of the dialog.

I apologize if I wasn't clear enough or have broken english

Upvotes: 1

Views: 359

Answers (1)

Bartosz
Bartosz

Reputation: 4786

I suppose these are the browser alerts, so you need to create your own service which catches these messages.

Create a class which implements the nsIPromptService2 and nsIPrompt prompt interface. In VB syntax is like that I suppose:

class FilteredPromptService Implements nsIPromptService2, nsIPrompt

And then override all the methods required by these interfaces with your own custom logic.

Upvotes: 0

Related Questions