Hey Matt,
Here is the code that works for me when I tested this out:
public Form1()
{
InitializeComponent();
// probably just easier to add this event in from the visual
editor
this.webBrowser1.NewWindow += new
System.ComponentModel.CancelEventHandler(this.webB rowser1_NewWindow);
this.webBrowser1.Navigating += new
System.Windows.Forms.WebBrowserNavigatingEventHand ler(this.webBrowser1_Navigating);
}
private void webBrowser1_Navigating(object sender,
WebBrowserNavigatingEventArgs e)
{
// the URL that it is going to..
MessageBox.Show(webBrowser1.StatusText.ToString()) ;
// 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_Navigating ()
private void webBrowser1_NewWindow(object sender, CancelEventArgs e)
{
// the URL that it is going to..
MessageBox.Show(webBrowser1.StatusText.ToString()) ;
// Load webBrowser1.StatusText.ToString() in new tab
// tell system we want to handle this event ourselves
e.Cancel = true;
} // end webBrowser1_NewWindow ()
"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