Public Class Form1
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
WebBrowser1.Navigate("http://examplesite.com/")
End Sub
Private Sub WebBrowser1_DocumentCompleted(ByVal sender As System.Object, ByVal e As System.Windows.Forms.WebBrowserDocumentCompletedEventArgs) Handles WebBrowser1.DocumentCompleted
getItems(WebBrowser1.Document.Body.InnerHtml.Split(vbCrLf),)
End Sub
Private Sub getItems(ByVal arLines() As String, ByVal selectedListBox As ListBox)
selectedListBox.Items.Clear() '// Clear in case the webpage reloads.
For i As Integer = 0 To arLines.Length - 1 '// Loop thru all Strings in the Array.
If arLines(i).Contains("<script>") Then '// Locate the String that .Contains...
Dim arTemp() As String = arLines(i).Split(">") '// .Split the entire String into Arrays.
For Each itm As String In arTemp '// Loop thru all Strings in the Array.
If itm.EndsWith("</A") Then '// check if String .EndsWith("</A")
itm = itm.Replace("</A", "") '// Remove the HTML Code from String.
End If
Next
Exit For '// Exit the Loop.
End If
Next
End Sub
End Class
I've been trying to block javascript/script for ever and just cannot get it.
I'm trying to block pesky ads etc. That's the code I was trying to use.