BigDubb
BigDubb

Reputation: 478

Is there a way to tell the Wiinforms WebBrowser control to use the current browser to open a hyperlink in?

I have a winforms application with a web browser control. I am wondering if there is a way to tell the browser control to open a URL in the current active browser, regardless of whether or not it is the default browser. My gut instinct is that this simply isn't feasible, as this control is utilizing the operating system's default browser as defined by the user.

Upvotes: 0

Views: 240

Answers (1)

nnm
nnm

Reputation: 875

use:

System.Diagnostics.Process.Start()


or just try this one:

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

Upvotes: 1

Related Questions