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

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.

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.