webbrowser如何禁止弹窗试了好多次都不行!这方面的资源还比较少,求高人指点!

解决方案 »

  1.   

    private void webBrowser_NewWindow(object sender, CancelEventArgs e)
            {
                e.Cancel = true;
            }
      

  2.   

    webBrowser.ScriptErrorsSuppressed=false;
    IHTMLWindow2 win = (IHTMLWindow2)webBrowser.Document.Window.DomWindow;
     string s = "window.alert = null;\r\nwindow.confirm = null;\r\nwindow.open = null;\r\nwindow.showModalDialog = null;";
     win.execScript(s, "javascript");
    试试