vb.netalertgeckofx

Disable Alert boxes when site not found Gecko Fx VB


I been searching around and cant seem to find anything relating to this. Basically i made a windowless app which uses the gecko webbrowser. Thing is, if i try browse to a site that does not exist. Example: www.gets.commmss, it will show me an alert box saying www.gets.commmss could not be found. Please check the name and try again. I dont want this to show as i handle these errors myself using the navigated & NavigationError handlers. Thing is, i cant seem to disable this annoying alert box! Any ideas much apprecited.

The geckofx version i am using is: GeckoFX v33.0.9.0

I am using visual studio 2012 and it is a windows form application.

Screenshot:enter image description here

This must be done via the app somewere as i dont think this is a javascript thing?


Solution

  • You need to override the PromptService.Alert(). The following code works for GeckoFX 45:

    public class NoPromptService : PromptService
    {
        public override void Alert(string dialogTitle, string text)
        {
            Debug.WriteLine(text);
        }
    }
    

    Then run this after initializing GeckoFX:

    PromptFactory.PromptServiceCreator = () => new NoPromptService();
    

    I got this from an older answer on the GeckoFX issue tracker.