Web浏览器新窗口问题

时间:2011-07-22 01:28:34

标签: c# .net browser

  

可能重复:
  Setting popup window to be a child of MDI Control when using WebBrowser Control

当我在WebBrowser控件中单击链接< a onclick="OpenNewWindow(); />时,我希望在新的WebBrowser中打开链接。

然而,我遇到了两个问题。

  1. 如何获取新网址
  2. 新浏览器窗口如何获取当前Cookie?

    webBrowser1.NewWindow += (o, e) =>
    {
        e.Cancel = true;
        Form2 f = new Form2();
        f.URL = ""; // How to get the new url 
        f.Cookie = ""; // How to copy the cookie to the new webbrowser?
        f.ShowDialog();
    };
    

1 个答案:

答案 0 :(得分:1)

您可以从WebBrowser和CancelEventArgs继承并完全自定义行为。请参阅Microsoft的此错误报告和解决方法:http://connect.microsoft.com/VisualStudio/feedback/details/115195/webbrowser-newwindow-event-does-not-give-the-url-of-the-new-window-in-eventargs

相关问题