Hey Matt,
Here is the code that works for me when I tested this out:
public Form1()
{
InitializeCompo nent();
// probably just easier to add this event in from the visual
editor
this.webBrowser 1.NewWindow += new
System.Componen tModel.CancelEv entHandler(this .webBrowser1_Ne wWindow);
this.webBrowser 1.Navigating += new
System.Windows. Forms.WebBrowse rNavigatingEven tHandler(this.w ebBrowser1_Navi gating);
}
private void webBrowser1_Nav igating(object sender,
WebBrowserNavig atingEventArgs e)
{
// the URL that it is going to..
MessageBox.Show (webBrowser1.St atusText.ToStri ng());
// you can just let the browser handle this since it can just
navigate within its current frame... but you could handle it here too
// tell system we want to handle this event ourselves
// e.Cancel = true;
} // end webBrowser1_Nav igating ()
private void webBrowser1_New Window(object sender, CancelEventArgs e)
{
// the URL that it is going to..
MessageBox.Show (webBrowser1.St atusText.ToStri ng());
// Load webBrowser1.Sta tusText.ToStrin g() in new tab
// tell system we want to handle this event ourselves
e.Cancel = true;
} // end webBrowser1_New Window ()
"Mateusz Rajca" wrote:
Hello! I am using the .NET Web Browser control (not Microsoft Web Browser
COM). How can I code this: When the user clicks on a link that will open a
new window/tab, instead of opening Internet Explorer with the link, it
creates a new tab and navigates to that link (my web browser is tab based). I
just need help getting the URL of the clicked link so that the web browser
control on the new tab can navigate to it. Any help?
Matt