禁用GeckoFX确认消息 [英] Disable GeckoFX confirm messages

查看:57
本文介绍了禁用GeckoFX确认消息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Windows应用程序中使用的是Gecko Web浏览器21.0.1版和.net Framework 4.0.

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?

如何禁用此类消息?

到目前为止,我已经尝试了以下设置,但它们没有帮助:

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;

推荐答案

您可以尝试提供自己的 nsIPromptService2 / nsIPrompt 实现.

You could try providing you own nsIPromptService2 / nsIPrompt implementation.

在程序启动时尽早运行此程序(尽管在XPCom.Initalize之后)

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

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

其中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;

这篇关于禁用GeckoFX确认消息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆