3

I am using Gecko Web browser version 21.0.1 and .net Framework 4.0 in my windows application.

When I navigate to certain web pages I get Pop up confirm message:

This web page is being redirected to a new location. Would you like to resend the form data you have typed to the new location?

How can I disable this kind of messages?

So far I have tried the following settings, but they didn't help:

GeckoPreferences.User["security.warn_viewing_mixed"] = false;
GeckoPreferences.User["plugin.state.flash"] = 0;
GeckoPreferences.User["browser.cache.disk.enable"] = false;
GeckoPreferences.User["browser.cache.memory.enable"] = false;
FireFalcon
  • 831
  • 11
  • 23

1 Answers1

2

You could try providing you own nsIPromptService2 / nsIPrompt implementation.

Run this early on program start up (Although after XPCom.Initalize)

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

Where FilteredPromptService is defined something like this:

internal class FilteredPromptService : nsIPromptService2, nsIPrompt
{
    private static PromptService _promptService = new PromptService();

    public void Alert(nsIDOMWindow aParent, string aDialogTitle, string aText)
    {
        if(/*want default behaviour */)
        {
         _promptService.Alert(aDialogTitle, aText);
        }
        // Else do nothing 
    }

    // TODO: implement other methods in similar fashion. (returning appropriate return values)
}

You will also need to make sure that error pages are not enabled:

GeckoPreferences.User["browser.xul.error_pages.enabled"] = false;
Tom
  • 6,325
  • 4
  • 31
  • 55
  • Hey Tom - this might be a silly question, but please let me know - if I want to do this, do I need to include every single method of the interfaces, even though I only want to mess with one? I.e. do I have to manually type in all the methods into the FilteredPromptService even I have no idea what they do? Is there an automatic way to say 'ok, just add them as wheterever they are in the original interface?'? Cheers! – Bartosz Mar 30 '15 at 08:13