EDN Admin
Well-known member
I am creating a webbrowser with Visual Basic, and I have finished everything but this: When I click on an external link, (I.E. On a photo, or on youtube) it opens up in a new IE window. I want it to open in my browser, not Internet Explorer.
I have read everything I have found on this subject, but it is all for normal web browsers. I want to do this for a tabbed web browser, not one without tabs. Basicly, I want to use this code with my tabbed web browser that uses tab control.
<span style="color:blue Private <span style="color:blue Sub WebBrowser1_NewWindow(<span style="color:blue ByVal sender
<span style="color:blue As <span style="color:blue Object, <span style="color:blue
ByVal e <span style="color:blue As System.ComponentModel.CancelEventArgs)
<span style="color:blue Handles WebBrowser1.NewWindow<br/>
<span style="color:green This will be triggered only when link tries to open in new window.
<br/>
<span style="color:green That means active element in web document will always be a Link.<br/>
<br/>
<span style="color:blue Dim myElement
<span style="color:blue As HtmlElement = WebBrowser1.Document.ActiveElement<br/>
<span style="color:blue Dim target
<span style="color:blue As <span style="color:blue String = myElement.GetAttribute(<span style="color:#a31515 "href")<br/>
<br/>
<span style="color:blue Dim newInstance
<span style="color:blue As <span style="color:blue New Form1<br/>
newInstance.Show()<br/>
newInstance.WebBrowser1.Navigate(target)<br/>
<br/>
<span style="color:green cancel opening IE window<br/>
e.Cancel = <span style="color:blue True<br/>
<span style="color:blue End <span style="color:blue Sub
Can somebody convert the code to be used in a browser with tabcontrol? I tried, and it works with one that DOESNT use it, but I want to use it with my browser with tabcontrol. And, I have read ALL of the ones previously given to other people. All I want
is for someone to convert that code, or give me a code that does the same thing.
View the full article
I have read everything I have found on this subject, but it is all for normal web browsers. I want to do this for a tabbed web browser, not one without tabs. Basicly, I want to use this code with my tabbed web browser that uses tab control.
<span style="color:blue Private <span style="color:blue Sub WebBrowser1_NewWindow(<span style="color:blue ByVal sender
<span style="color:blue As <span style="color:blue Object, <span style="color:blue
ByVal e <span style="color:blue As System.ComponentModel.CancelEventArgs)
<span style="color:blue Handles WebBrowser1.NewWindow<br/>
<span style="color:green This will be triggered only when link tries to open in new window.
<br/>
<span style="color:green That means active element in web document will always be a Link.<br/>
<br/>
<span style="color:blue Dim myElement
<span style="color:blue As HtmlElement = WebBrowser1.Document.ActiveElement<br/>
<span style="color:blue Dim target
<span style="color:blue As <span style="color:blue String = myElement.GetAttribute(<span style="color:#a31515 "href")<br/>
<br/>
<span style="color:blue Dim newInstance
<span style="color:blue As <span style="color:blue New Form1<br/>
newInstance.Show()<br/>
newInstance.WebBrowser1.Navigate(target)<br/>
<br/>
<span style="color:green cancel opening IE window<br/>
e.Cancel = <span style="color:blue True<br/>
<span style="color:blue End <span style="color:blue Sub
Can somebody convert the code to be used in a browser with tabcontrol? I tried, and it works with one that DOESNT use it, but I want to use it with my browser with tabcontrol. And, I have read ALL of the ones previously given to other people. All I want
is for someone to convert that code, or give me a code that does the same thing.
View the full article