Hello ,I have one problem making one simple program(actually I am new in this language).
So I have two webbrowsers.How I can every New Window that is opened in webbrowser1 to be opened in webbrowser2 instead?

Thanks in advance

Recommended Answers

All 5 Replies

Attach an event to the WebBrowser.Navigating event:

private void webBrowser1_Navigating(object sender, WebBrowserNavigatingEventArgs e) {
    e.Cancel = true;  // prevents this webbrowser from changing page
    webBrowser2.Navigate(e.Url); // makes the 2nd webbrowser navigate to the link
}

Sorry ,but this doesn't work.Do you have any other idea

Works fine here.

Yes it works for pop-ups.the main problems is that ,if i click in webbrowser1 in some link(which is opened in new window) ,automaticaly starts IE.I want to be loaded in Webbrowser2 instead.

private void webBrowser1_NewWindow(object sender, System.ComponentModel.CancelEventArgs e) {
    e.Cancel = true;
}
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.