webBrowser 禁止屏蔽alert confirm open showModalDialog

private void webBrowser1_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e)
{
IHTMLWindow2 ihtmlWin = webBrowser1.Document.Window.DomWindow as IHTMLWindow2;
//屏蔽alert
        string s = "var aaa=function(){return true;}\r\nwindow.alert = aaa;\r\nwindow.confirm = aaa;\r\nwindow.open = aaa;\r\nwindow.showModalDialog = aaa;";
ihtmlWin.execScript(s, "javascript");
}

webBrowser 禁止屏蔽alert confirm open showModalDialog

原文:https://www.cnblogs.com/q149072205/p/15268423.html

以上是webBrowser 禁止屏蔽alert confirm open showModalDialog的全部内容。
THE END
分享
二维码
< <上一篇
下一篇>>