Select Blog from http://dev.9cbs.net/user/2066
IF you trap the newwindow2 Event for the WebBrowser Control, You CAN Stop All New Windows Opening, Like this: Code:
Private
Sub
AxWebBrowser1_newwindow2 (
BYVAL Sender
As Object,
ByVal E
AskWEBBBROWSEREVENTS2_NEWINDOW2EVENT) HANDLES AXWEBBROWSER1.NEWWINDOW2
e.cancel =
True
End
Sub
Alternative You Could Instantiate An InternetExplorer Object and Pass The Handle To That, In this Way You CAN Trap What They Do I INTERNETEXPLORER TOO.
CODE:
Dim WithEvents ieChildBrowser As SHDocVw.InternetExplorer Private Sub AxWebBrowser1_NewWindow2 (ByVal sender As Object, ByVal e As AxSHDocVw.DWebBrowserEvents2_NewWindow2Event) Handles AxWebBrowser1.NewWindow2 ieChildBrowser = New SHDocVw.InternetExplorer () ieChildBrowser.RegisterAsBrowser = True e.ppDisp = ieChildBrowser End Sub
Now You Can Trap The Downloadbegin Event, Cut Out The Url The INSTANCE OF IE, THEN NAVIGATE2 IN YOUR OWN Webbrowser. Code:
Private Sub ieChildBrowser_DownloadBegin (ByVal sender As Object, ByVal e As System.EventArgs) Handles ieChildBrowser.DownloadBegin Dim strURL As String strURL = ieChildBrowser.Document.URL ieChildBrowser.Quit () ieChildBrowser = Nothing AxWebBrowser1.Navigate2 (strURL) End Sub