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.
Asked
Active
Viewed 235 times
0
-
possible duplicate of [Setting popup window to be a child of MDI Control when using WebBrowser Control](http://stackoverflow.com/questions/6470842/setting-popup-window-to-be-a-child-of-mdi-control-when-using-webbrowser-control) – Hans Passant Jun 19 '12 at 02:58
-
Redirecting it back to the same WebBrowser didn't work when I tried it. – Hans Passant Jun 19 '12 at 02:59
1 Answers
1
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

nnm
- 865
- 1
- 8
- 9
-
How would I use that if I handed in a hwnd for the active browser, not the web browser control ion the form? – BigDubb Jun 19 '12 at 16:27
-
Dim target As String = myElement.GetAttribute("href") --------- System.Diagnostics.Process.Start(target) --------- e.Cancel = True – nnm Jun 20 '12 at 11:06