Re: Webbrowser popup Capture
Code:
Dim newurl as string
Private Sub WebBrowser1_DocumentCompleted(ByVal sender As Object, ByVal e As System.Windows.Forms.WebBrowserDocumentCompletedEventArgs) Handles WebBrowser1.DocumentCompleted
If Not Webbrowser1.Document Is Nothing Then
AddHandler WebBrowser1.Document.Click, AddressOf Web_DocClicked
End If
End Sub
Private Sub WebBrowser1_NewWindow(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles WebBrowser1.NewWindow
e.Cancel = True
If newurl <> "" then sender.Navigate(newurl)
End Sub
Public Sub Web_DocClicked(ByVal sender As Object, ByVal e As HtmlElementEventArgs)
Try
Dim elm As HtmlElement =Webbrowser1.Document.ActiveElement
If elm.OuterHtml.StartsWith("<A ") Then newurl = elm.GetAttribute("href")
Catch ex As Exception
MsgBox(ex)
End Try
End Sub
Re: Webbrowser popup Capture
Code:
Public Sub Web_DocClicked(ByVal sender As Object, ByVal e As HtmlElementEventArgs)
If WebBrowser1.StatusText <> "" then
Newurl=WebBrowser1.StatusText
end if
End Sub
You can also use the status text do do so!
Re: Webbrowser popup Capture
thanks for the help with this i have moved forward with it using your code but it seems to pick up the web address of the first page that loads up not the popup am i missing something? here is my code so far to capture the address
Dim newurl As String
Private Sub Wbvirgin_DocumentCompleted(ByVal sender As Object, ByVal e As System.Windows.Forms.WebBrowserDocumentCompletedEventArgs) Handles WBVirginPopup.DocumentCompleted
If Not WBVirgin.Document Is Nothing Then
AddHandler WBVirgin.Document.Click, AddressOf Web_DocClicked
End If
End Sub
am i missing something?
Private Sub Wbvirgin_NewWindow(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles WBVirgin.NewWindow
' e.Cancel = True
If newurl <> "" Then sender.Navigate(newurl)
If WBVirgin.StatusText <> "" Then
newurl = Mid$(WBVirgin.StatusText, 12)
End If
WBVirginPopup.Navigate(newurl)
End Sub
'Public Sub Web_DocClicked(ByVal sender As Object, ByVal e As HtmlElementEventArgs)
' Try
' Dim elm As HtmlElement = WBVirgin.Document.ActiveElement
' If elm.OuterHtml.StartsWith("<A ") Then newurl = elm.GetAttribute("href")
' Catch ex As Exception
' MsgBox(ex)
' End Try
'End Sub
Public Sub Web_DocClicked(ByVal sender As Object, ByVal e As HtmlElementEventArgs)
If WBVirgin.StatusText <> "" Then
newurl = WBVirgin.StatusText
End If
End Sub