Sub WebView1_PageFinished (Url As String)
' Call the javascript injection routine to get the HTML
WebView1.JavaScriptEnabled = True
ExtractHTMLViaJavascript
End Sub
Sub ExtractHTMLViaJavascript
' Create an outerHTML directive and send it to webpagehtml()
Dim Javascript As String
Javascript = "B4A.CallSub('webpagehtml', false, document.documentElement.outerHTML)"
WebViewExtras1.executeJavascript(Javascript)
' Extracted value ends up in webpagehtml() via the callback
End Sub
Sub webpagehtml (strhtml As String)
' Capture the web page HTML as a return value from the injected Javascript
If CheckForNoVehiclesFound (strhtml) = True Then
WebView1.Visible = False
Else
WebView1.Visible = True
End If
End Sub
Sub ExtractHTMLViaJavascript
' Create an outerHTML directive and send it to webpagehtml()
Dim Javascript As String
Javascript = "B4A.CallSub('webpagehtml', false, document.documentElement.outerHTML)"
WebViewExtras1.executeJavascript(Javascript)
' Extracted value ends up in webpagehtml() via the callback
End Sub