0

Hi Guys,

I am currently making a web browser, and it is all working except when i open links which are to open in a new window, they open in IE. I have got the code below which "should" force the link to open in my existing browser, but it just opens a blank page.

Code:

 Private Sub WebBrowser1_NewWindow(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles WebBrowser1.NewWindow


        Dim myElement As HtmlElement = WebBrowser1.Document.ActiveElement
        Dim target As String = myElement.GetAttribute("href")

        Dim newInstance As New Form1
        newInstance.Show()
        newInstance.WebBrowser1.Navigate(target)



        e.Cancel = True
    End Sub

Any ideas/solutions?

Harry

2
Contributors
1
Reply
8
Views
2 Years
Discussion Span
Last Post by djjeavons
0

Hi

I copied your code as is and it works fine for me. I am assuming that you are right clicking on a link and selecting "Open in New Window" from the context menu. For me, this opens a new instance of Form1 with the page loading for the selected link.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.