本文介绍了禁用 JavaScript 警报 GeckoFX C#的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

限时删除!!

我正在尝试在 GeckoFX-33 + xulrunner 33 ( winforms c# ) 中禁用 JavaScript 警报,但我找不到解决方案.我检查了示例代码、源代码,但我找不到阻止警报的东西.我也在 about:config 中搜索,但没有成功.

I'm trying to disable JavaScript alert in GeckoFX-33 + xulrunner 33 ( winforms c# ) but I can't find a solution. I check the example codes, source code but I just can't find something that blocks the alert out. I searched in about:config as well without success.

有人知道我最后在哪里可以找到参考吗?

Anybody knows where I could find a reference at last ?

推荐答案

      geckoWebBrowser1.JavascriptError += (sender, error) =>
        {
            GeckoWebBrowser browser = geckoWebBrowser1;
            string text = "window.alert = function(){};";
            using (AutoJSContext context = new AutoJSContext(browser.Window.JSContext))
            {
                string result;
                //toolStripLabel1.Text = "was is loaded?";

                context.EvaluateScript(text, (nsISupports)browser.Window.DomWindow, out result);
            }
        };

这是 Gecko 29 的最终代码.

Here is the final code for Gecko 29.

这篇关于禁用 JavaScript 警报 GeckoFX C#的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

1403页,肝出来的..

09-08 06:24