开发者

Web Browser New Window Problem [duplicate]

开发者 https://www.devze.com 2023-03-21 23:13 出处:网络
This question already has answers here: Closed 11 years ago. 开发者_开发问答 Possible Duplicate: Setting popup window to be a child of MDI Control when using WebBrowser Control
This question already has answers here: Closed 11 years ago. 开发者_开发问答

Possible Duplicate:

Setting popup window to be a child of MDI Control when using WebBrowser Control

When I click a link < a onclick="OpenNewWindow(); /> in my WebBrowser control, I'd like to have the link open in a new WebBrowser .

I'm having two issues with this, however.

  1. How do I get the new URL
  2. How will the new browser window get the current 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();
    };
    


You can inherit from WebBrowser and CancelEventArgs and customize the behavior completely. See this bug report and workaround from Microsoft: http://connect.microsoft.com/VisualStudio/feedback/details/115195/webbrowser-newwindow-event-does-not-give-the-url-of-the-new-window-in-eventargs

0

精彩评论

暂无评论...
验证码 换一张
取 消