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.
- How do I get the new URL
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
精彩评论