C# winform 如何屏蔽webBrowser中的弹窗和脚本错误? 不惜分。各位路过的,支支招。
1个回答
2013-07-30
展开全部
//屏蔽一些弹出窗口
void wb_NavigateComplete2(object pDisp, ref object URL)
{
mshtml.IHTMLDocument2 doc = (wb.ActiveXInstance as SHDocVw.WebBrowser).Document as mshtml.IHTMLDocument2;
doc.parentWindow.execScript("window.alert=null", "javascript");
doc.parentWindow.execScript("window.confirm=null", "javascript");
doc.parentWindow.execScript("window.open=null", "javascript");
doc.parentWindow.execScript("window.showModalDialog=null", "javascript");
doc.parentWindow.execScript("window.close=null", "javascript");} 详细请见: http://www.cnblogs.com/oldsea/archive/2009/07/31/1536252.html
void wb_NavigateComplete2(object pDisp, ref object URL)
{
mshtml.IHTMLDocument2 doc = (wb.ActiveXInstance as SHDocVw.WebBrowser).Document as mshtml.IHTMLDocument2;
doc.parentWindow.execScript("window.alert=null", "javascript");
doc.parentWindow.execScript("window.confirm=null", "javascript");
doc.parentWindow.execScript("window.open=null", "javascript");
doc.parentWindow.execScript("window.showModalDialog=null", "javascript");
doc.parentWindow.execScript("window.close=null", "javascript");} 详细请见: http://www.cnblogs.com/oldsea/archive/2009/07/31/1536252.html
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询